From 8871f5a4ac26072f155d0d74850aed4cc7e74356 Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Sat, 17 Nov 2018 15:01:45 -0500 Subject: [PATCH] Memory: remove ReadBlock with current process --- src/core/gdbstub/gdbstub.cpp | 6 ++++-- src/core/hle/kernel/svc.cpp | 2 +- src/core/memory.cpp | 5 ----- src/core/memory.h | 1 - src/core/rpc/rpc_server.cpp | 3 ++- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index dcc45ebcf..9e13f9a46 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp @@ -836,7 +836,8 @@ static void ReadMemory() { } std::vector data(len); - Memory::ReadBlock(addr, data.data(), len); + Memory::ReadBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), addr, data.data(), + len); MemToGdbHex(reply, data.data(), len); reply[len * 2] = '\0'; @@ -914,7 +915,8 @@ static bool CommitBreakpoint(BreakpointType type, VAddr addr, u32 len) { breakpoint.active = true; breakpoint.addr = addr; breakpoint.len = len; - Memory::ReadBlock(addr, breakpoint.inst.data(), breakpoint.inst.size()); + Memory::ReadBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), addr, + breakpoint.inst.data(), breakpoint.inst.size()); static constexpr std::array btrap{0x70, 0x00, 0x20, 0xe1}; Memory::WriteBlock(addr, btrap.data(), btrap.size()); Core::CPU().ClearInstructionCache(); diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 5dd82075d..2d9466c6f 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -801,7 +801,7 @@ void SVC::OutputDebugString(VAddr address, s32 len) { } std::string string(len, ' '); - Memory::ReadBlock(address, string.data(), len); + Memory::ReadBlock(*kernel.GetCurrentProcess(), address, string.data(), len); LOG_DEBUG(Debug_Emulated, "{}", string); } diff --git a/src/core/memory.cpp b/src/core/memory.cpp index f59630940..25e014253 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -483,11 +483,6 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_ } } -void ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_t size) { - ReadBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), src_addr, dest_buffer, - size); -} - void Write8(const VAddr addr, const u8 data) { Write(addr, data); } diff --git a/src/core/memory.h b/src/core/memory.h index 15efa6781..1e6b6e615 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -197,7 +197,6 @@ void Write32(VAddr addr, u32 data); void Write64(VAddr addr, u64 data); void ReadBlock(const Kernel::Process& process, VAddr src_addr, void* dest_buffer, std::size_t size); -void ReadBlock(VAddr src_addr, void* dest_buffer, std::size_t size); void WriteBlock(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer, std::size_t size); void WriteBlock(VAddr dest_addr, const void* src_buffer, std::size_t size); diff --git a/src/core/rpc/rpc_server.cpp b/src/core/rpc/rpc_server.cpp index 819880196..b9246e922 100644 --- a/src/core/rpc/rpc_server.cpp +++ b/src/core/rpc/rpc_server.cpp @@ -29,7 +29,8 @@ void RPCServer::HandleReadMemory(Packet& packet, u32 address, u32 data_size) { } // Note: Memory read occurs asynchronously from the state of the emulator - Memory::ReadBlock(address, packet.GetPacketData().data(), data_size); + Memory::ReadBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), address, + packet.GetPacketData().data(), data_size); packet.SetPacketDataSize(data_size); packet.SendReply(); }