diff options
| author | 2015-07-17 01:23:22 -0500 | |
|---|---|---|
| committer | 2015-07-17 11:03:56 -0500 | |
| commit | 9e2962081ac21e626ea375781fea16ee301e7241 (patch) | |
| tree | 8d5c41f276bc1dfedea021fe2516175d59a0e64d /src | |
| parent | Merge pull request #936 from archshift/kill-sourceforge (diff) | |
| download | yuzu-9e2962081ac21e626ea375781fea16ee301e7241.tar.gz yuzu-9e2962081ac21e626ea375781fea16ee301e7241.tar.xz yuzu-9e2962081ac21e626ea375781fea16ee301e7241.zip | |
Kernel/SVC: Implemented svcQueryMemory.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/function_wrappers.h | 12 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 16 |
2 files changed, 24 insertions, 4 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 5949cb470..1ac6032a6 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h | |||
| @@ -87,8 +87,16 @@ template<ResultCode func(u32, s64)> void Wrap() { | |||
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | template<ResultCode func(void*, void*, u32)> void Wrap(){ | 90 | template<ResultCode func(MemoryInfo*, PageInfo*, u32)> void Wrap() { |
| 91 | FuncReturn(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2)).raw); | 91 | MemoryInfo memory_info = {}; |
| 92 | PageInfo page_info = {}; | ||
| 93 | u32 retval = func(&memory_info, &page_info, PARAM(2)).raw; | ||
| 94 | Core::g_app_core->SetReg(1, memory_info.base_address); | ||
| 95 | Core::g_app_core->SetReg(2, memory_info.size); | ||
| 96 | Core::g_app_core->SetReg(3, memory_info.permission); | ||
| 97 | Core::g_app_core->SetReg(4, memory_info.state); | ||
| 98 | Core::g_app_core->SetReg(5, page_info.flags); | ||
| 99 | FuncReturn(retval); | ||
| 92 | } | 100 | } |
| 93 | 101 | ||
| 94 | template<ResultCode func(s32*, u32)> void Wrap(){ | 102 | template<ResultCode func(s32*, u32)> void Wrap(){ |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 6cde4fc87..9d441ccfc 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include "core/hle/kernel/shared_memory.h" | 22 | #include "core/hle/kernel/shared_memory.h" |
| 23 | #include "core/hle/kernel/thread.h" | 23 | #include "core/hle/kernel/thread.h" |
| 24 | #include "core/hle/kernel/timer.h" | 24 | #include "core/hle/kernel/timer.h" |
| 25 | #include "core/hle/kernel/vm_manager.h" | ||
| 25 | 26 | ||
| 26 | #include "core/hle/function_wrappers.h" | 27 | #include "core/hle/function_wrappers.h" |
| 27 | #include "core/hle/result.h" | 28 | #include "core/hle/result.h" |
| @@ -530,8 +531,19 @@ static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) | |||
| 530 | } | 531 | } |
| 531 | 532 | ||
| 532 | /// Query memory | 533 | /// Query memory |
| 533 | static ResultCode QueryMemory(void* info, void* out, u32 addr) { | 534 | static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32 addr) { |
| 534 | LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr); | 535 | auto vma = Kernel::g_current_process->address_space->FindVMA(addr); |
| 536 | |||
| 537 | if (vma == Kernel::g_current_process->address_space->vma_map.end()) | ||
| 538 | return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage); | ||
| 539 | |||
| 540 | memory_info->base_address = vma->second.base; | ||
| 541 | memory_info->permission = static_cast<u32>(vma->second.permissions); | ||
| 542 | memory_info->size = vma->second.size; | ||
| 543 | memory_info->state = static_cast<u32>(vma->second.meminfo_state); | ||
| 544 | |||
| 545 | page_info->flags = 0; | ||
| 546 | LOG_TRACE(Kernel_SVC, "called addr=0x%08X", addr); | ||
| 535 | return RESULT_SUCCESS; | 547 | return RESULT_SUCCESS; |
| 536 | } | 548 | } |
| 537 | 549 | ||