diff options
| author | 2017-12-28 21:38:38 -0500 | |
|---|---|---|
| committer | 2017-12-28 21:38:38 -0500 | |
| commit | 6e021f22b8c61654aa1e72ceef16202a11d42016 (patch) | |
| tree | 965a3c330f88ed6724c5315abb8e673d5af58b38 /src | |
| parent | process: Add method to mirror a memory region. (diff) | |
| download | yuzu-6e021f22b8c61654aa1e72ceef16202a11d42016.tar.gz yuzu-6e021f22b8c61654aa1e72ceef16202a11d42016.tar.xz yuzu-6e021f22b8c61654aa1e72ceef16202a11d42016.zip | |
svc: Implement MapMemory.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/function_wrappers.h | 5 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 14 | ||||
| -rw-r--r-- | src/core/memory.h | 2 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 528208178..5d6d0eb56 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h | |||
| @@ -42,6 +42,11 @@ void Wrap() { | |||
| 42 | FuncReturn(func(PARAM(0), PARAM(1)).raw); | 42 | FuncReturn(func(PARAM(0), PARAM(1)).raw); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | template <ResultCode func(u64, u64, u64)> | ||
| 46 | void Wrap() { | ||
| 47 | FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw); | ||
| 48 | } | ||
| 49 | |||
| 45 | template <ResultCode func(u64, u64, s64)> | 50 | template <ResultCode func(u64, u64, s64)> |
| 46 | void Wrap() { | 51 | void Wrap() { |
| 47 | FuncReturn(func(PARAM(1), PARAM(2), (s64)PARAM(3)).raw); | 52 | FuncReturn(func(PARAM(1), PARAM(2), (s64)PARAM(3)).raw); |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index ae0ceb252..47041afd4 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -26,12 +26,20 @@ namespace SVC { | |||
| 26 | 26 | ||
| 27 | /// Set the process heap to a given Size. It can both extend and shrink the heap. | 27 | /// Set the process heap to a given Size. It can both extend and shrink the heap. |
| 28 | static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { | 28 | static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { |
| 29 | LOG_TRACE(Kernel_SVC, "called, heap_size=%ull", heap_size); | 29 | LOG_TRACE(Kernel_SVC, "called, heap_size=0x%llx", heap_size); |
| 30 | auto& process = *Kernel::g_current_process; | 30 | auto& process = *Kernel::g_current_process; |
| 31 | CASCADE_RESULT(*heap_addr, process.HeapAllocate(Memory::HEAP_VADDR, heap_size, Kernel::VMAPermission::ReadWrite)); | 31 | CASCADE_RESULT(*heap_addr, process.HeapAllocate(Memory::HEAP_VADDR, heap_size, |
| 32 | Kernel::VMAPermission::ReadWrite)); | ||
| 32 | return RESULT_SUCCESS; | 33 | return RESULT_SUCCESS; |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 36 | /// Maps a memory range into a different range. | ||
| 37 | static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { | ||
| 38 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x%llx, src_addr=0x%llx, size=0x%llx", dst_addr, | ||
| 39 | src_addr, size); | ||
| 40 | return Kernel::g_current_process->MirrorMemory(dst_addr, src_addr, size); | ||
| 41 | } | ||
| 42 | |||
| 35 | /// Connect to an OS service given the port name, returns the handle to the port to out | 43 | /// Connect to an OS service given the port name, returns the handle to the port to out |
| 36 | static ResultCode ConnectToPort(Kernel::Handle* out_handle, VAddr port_name_address) { | 44 | static ResultCode ConnectToPort(Kernel::Handle* out_handle, VAddr port_name_address) { |
| 37 | if (!Memory::IsValidVirtualAddress(port_name_address)) | 45 | if (!Memory::IsValidVirtualAddress(port_name_address)) |
| @@ -216,7 +224,7 @@ static const FunctionDef SVC_Table[] = { | |||
| 216 | {0x01, HLE::Wrap<SetHeapSize>, "svcSetHeapSize"}, | 224 | {0x01, HLE::Wrap<SetHeapSize>, "svcSetHeapSize"}, |
| 217 | {0x02, nullptr, "svcSetMemoryPermission"}, | 225 | {0x02, nullptr, "svcSetMemoryPermission"}, |
| 218 | {0x03, nullptr, "svcSetMemoryAttribute"}, | 226 | {0x03, nullptr, "svcSetMemoryAttribute"}, |
| 219 | {0x04, nullptr, "svcMapMemory"}, | 227 | {0x04, HLE::Wrap<MapMemory>, "svcMapMemory"}, |
| 220 | {0x05, nullptr, "svcUnmapMemory"}, | 228 | {0x05, nullptr, "svcUnmapMemory"}, |
| 221 | {0x06, HLE::Wrap<QueryMemory>, "svcQueryMemory"}, | 229 | {0x06, HLE::Wrap<QueryMemory>, "svcQueryMemory"}, |
| 222 | {0x07, nullptr, "svcExitProcess"}, | 230 | {0x07, nullptr, "svcExitProcess"}, |
diff --git a/src/core/memory.h b/src/core/memory.h index 8c60f1dd3..71ba487fc 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -136,7 +136,7 @@ enum : VAddr { | |||
| 136 | 136 | ||
| 137 | /// Application heap (includes stack). | 137 | /// Application heap (includes stack). |
| 138 | HEAP_VADDR = 0x108000000, | 138 | HEAP_VADDR = 0x108000000, |
| 139 | HEAP_SIZE = 0x08000000, | 139 | HEAP_SIZE = 0x18000000, |
| 140 | HEAP_VADDR_END = HEAP_VADDR + HEAP_SIZE, | 140 | HEAP_VADDR_END = HEAP_VADDR + HEAP_SIZE, |
| 141 | 141 | ||
| 142 | /// Area where shared memory buffers are mapped onto. | 142 | /// Area where shared memory buffers are mapped onto. |