summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-07-17 21:33:26 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-07-17 21:33:26 +0200
commit41513cfb0c9373fb5fc15768f6297bd4d411f526 (patch)
tree212887a058fd5bc01eadfbb16d1de0059016c964 /src/core
parentMerge pull request #937 from yuriks/codeset-leak (diff)
parentKernel/SVC: Implemented svcQueryMemory. (diff)
downloadyuzu-41513cfb0c9373fb5fc15768f6297bd4d411f526.tar
yuzu-41513cfb0c9373fb5fc15768f6297bd4d411f526.tar.gz
yuzu-41513cfb0c9373fb5fc15768f6297bd4d411f526.tar.bz2
yuzu-41513cfb0c9373fb5fc15768f6297bd4d411f526.tar.lz
yuzu-41513cfb0c9373fb5fc15768f6297bd4d411f526.tar.xz
yuzu-41513cfb0c9373fb5fc15768f6297bd4d411f526.tar.zst
yuzu-41513cfb0c9373fb5fc15768f6297bd4d411f526.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/function_wrappers.h12
-rw-r--r--src/core/hle/svc.cpp16
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() {
}
}
-template<ResultCode func(void*, void*, u32)> void Wrap(){
- FuncReturn(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2)).raw);
+template<ResultCode func(MemoryInfo*, PageInfo*, u32)> void Wrap() {
+ MemoryInfo memory_info = {};
+ PageInfo page_info = {};
+ u32 retval = func(&memory_info, &page_info, PARAM(2)).raw;
+ Core::g_app_core->SetReg(1, memory_info.base_address);
+ Core::g_app_core->SetReg(2, memory_info.size);
+ Core::g_app_core->SetReg(3, memory_info.permission);
+ Core::g_app_core->SetReg(4, memory_info.state);
+ Core::g_app_core->SetReg(5, page_info.flags);
+ FuncReturn(retval);
}
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 @@
#include "core/hle/kernel/shared_memory.h"
#include "core/hle/kernel/thread.h"
#include "core/hle/kernel/timer.h"
+#include "core/hle/kernel/vm_manager.h"
#include "core/hle/function_wrappers.h"
#include "core/hle/result.h"
@@ -530,8 +531,19 @@ static ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count)
}
/// Query memory
-static ResultCode QueryMemory(void* info, void* out, u32 addr) {
- LOG_ERROR(Kernel_SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr);
+static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32 addr) {
+ auto vma = Kernel::g_current_process->address_space->FindVMA(addr);
+
+ if (vma == Kernel::g_current_process->address_space->vma_map.end())
+ return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage);
+
+ memory_info->base_address = vma->second.base;
+ memory_info->permission = static_cast<u32>(vma->second.permissions);
+ memory_info->size = vma->second.size;
+ memory_info->state = static_cast<u32>(vma->second.meminfo_state);
+
+ page_info->flags = 0;
+ LOG_TRACE(Kernel_SVC, "called addr=0x%08X", addr);
return RESULT_SUCCESS;
}