Basic handling for MAP_VOID, MAP_STACK, and MAP_ANON in mmap.

This commit is contained in:
Stephen Miller 2025-12-07 12:59:54 -06:00
parent d3ad728ac0
commit 0acd69d82c
2 changed files with 9 additions and 1 deletions

View File

@ -668,9 +668,14 @@ void* PS4_SYSV_ABI posix_mmap(void* addr, u64 len, s32 prot, s32 flags, s32 fd,
}
s32 result = ORBIS_OK;
if (fd == -1) {
if (True(mem_flags & Core::MemoryMapFlags::Anon) ||
True(mem_flags & Core::MemoryMapFlags::Stack)) {
result = memory->MapMemory(&addr_out, aligned_addr, aligned_size, mem_prot, mem_flags,
Core::VMAType::Flexible, "anon", false);
} else if (True(mem_flags & Core::MemoryMapFlags::Void)) {
result =
memory->MapMemory(&addr_out, aligned_addr, aligned_size, Core::MemoryProt::NoAccess,
mem_flags, Core::VMAType::Reserved, "anon", false);
} else {
result = memory->MapFile(&addr_out, aligned_addr, aligned_size, mem_prot, mem_flags, fd,
phys_addr);

View File

@ -44,8 +44,11 @@ enum class MemoryMapFlags : u32 {
Shared = 1,
Private = 2,
Fixed = 0x10,
Void = 0x100,
NoOverwrite = 0x80,
Stack = 0x400,
NoSync = 0x800,
Anon = 0x1000,
NoCore = 0x20000,
NoCoalesce = 0x400000,
};