diff options
Diffstat (limited to 'src/core/hle/syscall.cpp')
| -rw-r--r-- | src/core/hle/syscall.cpp | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/src/core/hle/syscall.cpp b/src/core/hle/syscall.cpp index e5533a741..df6412743 100644 --- a/src/core/hle/syscall.cpp +++ b/src/core/hle/syscall.cpp | |||
| @@ -15,14 +15,29 @@ | |||
| 15 | 15 | ||
| 16 | namespace Syscall { | 16 | namespace Syscall { |
| 17 | 17 | ||
| 18 | enum ControlMemoryOperation { | ||
| 19 | MEMORY_OPERATION_HEAP = 0x00000003, | ||
| 20 | MEMORY_OPERATION_GSP_HEAP = 0x00010003, | ||
| 21 | }; | ||
| 22 | |||
| 23 | enum MapMemoryPermission { | ||
| 24 | MEMORY_PERMISSION_UNMAP = 0x00000000, | ||
| 25 | MEMORY_PERMISSION_NORMAL = 0x00000001, | ||
| 26 | }; | ||
| 27 | |||
| 18 | /// Map application or GSP heap memory | 28 | /// Map application or GSP heap memory |
| 19 | Result ControlMemory(void* outaddr, u32 addr0, u32 addr1, u32 size, u32 operation, u32 permissions) { | 29 | Result ControlMemory(u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { |
| 20 | u32 virtual_address = 0x00000000; | 30 | u32 virtual_address = 0x00000000; |
| 21 | 31 | ||
| 22 | switch (operation) { | 32 | switch (operation) { |
| 23 | 33 | ||
| 24 | // Map GSP heap memory? | 34 | // Map normal heap memory |
| 25 | case 0x00010003: | 35 | case MEMORY_OPERATION_HEAP: |
| 36 | virtual_address = Memory::MapBlock_Heap(size, operation, permissions); | ||
| 37 | break; | ||
| 38 | |||
| 39 | // Map GSP heap memory | ||
| 40 | case MEMORY_OPERATION_GSP_HEAP: | ||
| 26 | virtual_address = Memory::MapBlock_HeapGSP(size, operation, permissions); | 41 | virtual_address = Memory::MapBlock_HeapGSP(size, operation, permissions); |
| 27 | break; | 42 | break; |
| 28 | 43 | ||
| @@ -31,7 +46,22 @@ Result ControlMemory(void* outaddr, u32 addr0, u32 addr1, u32 size, u32 operatio | |||
| 31 | ERROR_LOG(OSHLE, "Unknown ControlMemory operation %08X", operation); | 46 | ERROR_LOG(OSHLE, "Unknown ControlMemory operation %08X", operation); |
| 32 | } | 47 | } |
| 33 | 48 | ||
| 34 | Core::g_app_core->SetReg(1, Memory::MapBlock_HeapGSP(size, operation, permissions)); | 49 | Core::g_app_core->SetReg(1, virtual_address); |
| 50 | return 0; | ||
| 51 | } | ||
| 52 | |||
| 53 | /// Maps a memory block to specified address | ||
| 54 | Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherpermission) { | ||
| 55 | int x = 0; | ||
| 56 | switch (mypermissions) { | ||
| 57 | case MEMORY_PERMISSION_NORMAL: | ||
| 58 | case MEMORY_PERMISSION_NORMAL + 1: | ||
| 59 | case MEMORY_PERMISSION_NORMAL + 2: | ||
| 60 | Memory::MapBlock_Shared(memblock, addr, mypermissions); | ||
| 61 | break; | ||
| 62 | default: | ||
| 63 | ERROR_LOG(OSHLE, "Unknown MapMemoryBlock permissions %08X", mypermissions); | ||
| 64 | } | ||
| 35 | return 0; | 65 | return 0; |
| 36 | } | 66 | } |
| 37 | 67 | ||
| @@ -63,7 +93,7 @@ Result WaitSynchronization1(Handle handle, s64 nanoseconds) { | |||
| 63 | 93 | ||
| 64 | const HLE::FunctionDef Syscall_Table[] = { | 94 | const HLE::FunctionDef Syscall_Table[] = { |
| 65 | {0x00, NULL, "Unknown"}, | 95 | {0x00, NULL, "Unknown"}, |
| 66 | {0x01, WrapI_VUUUUU<ControlMemory>, "ControlMemory"}, | 96 | {0x01, WrapI_UUUUU<ControlMemory>, "ControlMemory"}, |
| 67 | {0x02, NULL, "QueryMemory"}, | 97 | {0x02, NULL, "QueryMemory"}, |
| 68 | {0x03, NULL, "ExitProcess"}, | 98 | {0x03, NULL, "ExitProcess"}, |
| 69 | {0x04, NULL, "GetProcessAffinityMask"}, | 99 | {0x04, NULL, "GetProcessAffinityMask"}, |
| @@ -93,7 +123,7 @@ const HLE::FunctionDef Syscall_Table[] = { | |||
| 93 | {0x1C, NULL, "CancelTimer"}, | 123 | {0x1C, NULL, "CancelTimer"}, |
| 94 | {0x1D, NULL, "ClearTimer"}, | 124 | {0x1D, NULL, "ClearTimer"}, |
| 95 | {0x1E, NULL, "CreateMemoryBlock"}, | 125 | {0x1E, NULL, "CreateMemoryBlock"}, |
| 96 | {0x1F, NULL, "MapMemoryBlock"}, | 126 | {0x1F, WrapI_UUUU<MapMemoryBlock>, "MapMemoryBlock"}, |
| 97 | {0x20, NULL, "UnmapMemoryBlock"}, | 127 | {0x20, NULL, "UnmapMemoryBlock"}, |
| 98 | {0x21, NULL, "CreateAddressArbiter"}, | 128 | {0x21, NULL, "CreateAddressArbiter"}, |
| 99 | {0x22, NULL, "ArbitrateAddress"}, | 129 | {0x22, NULL, "ArbitrateAddress"}, |