Address review

This commit is contained in:
TheASVigilante 2023-02-09 18:31:20 +01:00 committed by Billy Laws
parent b780e2b755
commit 3168e8efc0

View File

@ -176,7 +176,7 @@ namespace skyline::kernel::svc {
if (!sourceObject) if (!sourceObject)
throw exception("svcUnmapMemory: Cannot find source memory object in handle table for address 0x{:X}", source); throw exception("svcUnmapMemory: Cannot find source memory object in handle table for address 0x{:X}", source);
state.process->memory.FreeMemory(sourceChunk.value().memory->guest); state.process->memory.FreeMemory(std::span<u8>(source, size));
state.process->CloseHandle(sourceObject->handle); state.process->CloseHandle(sourceObject->handle);
Logger::Debug("Unmapped range 0x{:X} - 0x{:X} to 0x{:X} - 0x{:X} (Size: 0x{:X} bytes)", source, source + size, destination, destination + size, size); Logger::Debug("Unmapped range 0x{:X} - 0x{:X} to 0x{:X} - 0x{:X} (Size: 0x{:X} bytes)", source, source + size, destination, destination + size, size);
@ -1083,9 +1083,8 @@ namespace skyline::kernel::svc {
if (memory->memoryState == memory::states::Heap) { if (memory->memoryState == memory::states::Heap) {
if (memory->guest.data() >= pointer) { if (memory->guest.data() >= pointer) {
if (memory->guest.size() <= size) { if (memory->guest.size() <= size) {
state.process->memory.FreeMemory(memory->guest); memory->Resize(0);
state.process->CloseHandle(memory->handle); state.process->CloseHandle(memory->handle);
delete memory;
} else { } else {
memory->Remap(span<u8>{pointer + size, static_cast<size_t>((pointer + memory->guest.size() - memory->guest.data())) - size}); memory->Remap(span<u8>{pointer + size, static_cast<size_t>((pointer + memory->guest.size() - memory->guest.data())) - size});
} }
@ -1105,6 +1104,8 @@ namespace skyline::kernel::svc {
} }
} }
state.process->memory.FreeMemory(std::span<u8>(pointer, size));
state.ctx->gpr.w0 = Result{}; state.ctx->gpr.w0 = Result{};
} }