kernel/shared_memory: Make Map() and Unmap() take the target process by reference rather than as a pointer

Both member functions assume the passed in target process will not be
null. Instead of making this assumption implicit, we can change the
functions to be references and enforce this at the type-system level.
This commit is contained in:
Lioncash 2018-11-19 09:05:04 -05:00 committed by fearlessTobi
parent 0f544af89a
commit 86c36cb176
3 changed files with 13 additions and 13 deletions

View file

@ -322,7 +322,7 @@ ResultCode SVC::MapMemoryBlock(Handle handle, u32 addr, u32 permissions, u32 oth
case MemoryPermission::WriteExecute:
case MemoryPermission::ReadWriteExecute:
case MemoryPermission::DontCare:
return shared_memory->Map(kernel.GetCurrentProcess().get(), addr, permissions_type,
return shared_memory->Map(*kernel.GetCurrentProcess(), addr, permissions_type,
static_cast<MemoryPermission>(other_permissions));
default:
LOG_ERROR(Kernel_SVC, "unknown permissions=0x{:08X}", permissions);
@ -341,7 +341,7 @@ ResultCode SVC::UnmapMemoryBlock(Handle handle, u32 addr) {
if (shared_memory == nullptr)
return ERR_INVALID_HANDLE;
return shared_memory->Unmap(current_process.get(), addr);
return shared_memory->Unmap(*current_process, addr);
}
/// Connect to an OS service given the port name, returns the handle to the port to out