mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-16 12:09:07 +00:00
Basic handling for MAP_VOID, MAP_STACK, and MAP_ANON in mmap.
This commit is contained in:
parent
d3ad728ac0
commit
0acd69d82c
@ -668,9 +668,14 @@ void* PS4_SYSV_ABI posix_mmap(void* addr, u64 len, s32 prot, s32 flags, s32 fd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
s32 result = ORBIS_OK;
|
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,
|
result = memory->MapMemory(&addr_out, aligned_addr, aligned_size, mem_prot, mem_flags,
|
||||||
Core::VMAType::Flexible, "anon", false);
|
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 {
|
} else {
|
||||||
result = memory->MapFile(&addr_out, aligned_addr, aligned_size, mem_prot, mem_flags, fd,
|
result = memory->MapFile(&addr_out, aligned_addr, aligned_size, mem_prot, mem_flags, fd,
|
||||||
phys_addr);
|
phys_addr);
|
||||||
|
|||||||
@ -44,8 +44,11 @@ enum class MemoryMapFlags : u32 {
|
|||||||
Shared = 1,
|
Shared = 1,
|
||||||
Private = 2,
|
Private = 2,
|
||||||
Fixed = 0x10,
|
Fixed = 0x10,
|
||||||
|
Void = 0x100,
|
||||||
NoOverwrite = 0x80,
|
NoOverwrite = 0x80,
|
||||||
|
Stack = 0x400,
|
||||||
NoSync = 0x800,
|
NoSync = 0x800,
|
||||||
|
Anon = 0x1000,
|
||||||
NoCore = 0x20000,
|
NoCore = 0x20000,
|
||||||
NoCoalesce = 0x400000,
|
NoCoalesce = 0x400000,
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user