svc: Implement svcUnmapMemory.

This commit is contained in:
bunnei 2017-12-31 15:22:49 -05:00
parent a3228d9b77
commit 3a91a62b8f
3 changed files with 15 additions and 1 deletions

View file

@ -292,6 +292,10 @@ ResultCode Process::MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size) {
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
ResultCode Process::UnmapMemory(VAddr dst_addr, VAddr /*src_addr*/, u64 size) {
return vm_manager.UnmapRange(dst_addr, size);
}
Kernel::Process::Process() {} Kernel::Process::Process() {}
Kernel::Process::~Process() {} Kernel::Process::~Process() {}

View file

@ -179,6 +179,9 @@ public:
ResultCode MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size); ResultCode MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size);
ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size);
private: private:
Process(); Process();
~Process() override; ~Process() override;

View file

@ -41,6 +41,13 @@ static ResultCode MapMemory(VAddr dst_addr, VAddr src_addr, u64 size) {
return Kernel::g_current_process->MirrorMemory(dst_addr, src_addr, size); return Kernel::g_current_process->MirrorMemory(dst_addr, src_addr, size);
} }
/// Unmaps a region that was previously mapped with svcMapMemory
static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) {
LOG_TRACE(Kernel_SVC, "called, dst_addr=0x%llx, src_addr=0x%llx, size=0x%llx", dst_addr,
src_addr, size);
return Kernel::g_current_process->UnmapMemory(dst_addr, src_addr, size);
}
/// Connect to an OS service given the port name, returns the handle to the port to out /// Connect to an OS service given the port name, returns the handle to the port to out
static ResultCode ConnectToPort(Kernel::Handle* out_handle, VAddr port_name_address) { static ResultCode ConnectToPort(Kernel::Handle* out_handle, VAddr port_name_address) {
if (!Memory::IsValidVirtualAddress(port_name_address)) if (!Memory::IsValidVirtualAddress(port_name_address))
@ -241,7 +248,7 @@ static const FunctionDef SVC_Table[] = {
{0x02, nullptr, "svcSetMemoryPermission"}, {0x02, nullptr, "svcSetMemoryPermission"},
{0x03, nullptr, "svcSetMemoryAttribute"}, {0x03, nullptr, "svcSetMemoryAttribute"},
{0x04, HLE::Wrap<MapMemory>, "svcMapMemory"}, {0x04, HLE::Wrap<MapMemory>, "svcMapMemory"},
{0x05, nullptr, "svcUnmapMemory"}, {0x05, HLE::Wrap<UnmapMemory>, "svcUnmapMemory"},
{0x06, HLE::Wrap<QueryMemory>, "svcQueryMemory"}, {0x06, HLE::Wrap<QueryMemory>, "svcQueryMemory"},
{0x07, nullptr, "svcExitProcess"}, {0x07, nullptr, "svcExitProcess"},
{0x08, nullptr, "svcCreateThread"}, {0x08, nullptr, "svcCreateThread"},