1
0
Fork 0

Memory: remove ReadBlock with current process

This commit is contained in:
Weiyi Wang 2018-11-17 15:01:45 -05:00
parent 524364d95a
commit 8871f5a4ac
5 changed files with 7 additions and 10 deletions

View File

@ -836,7 +836,8 @@ static void ReadMemory() {
} }
std::vector<u8> data(len); std::vector<u8> data(len);
Memory::ReadBlock(addr, data.data(), len); Memory::ReadBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), addr, data.data(),
len);
MemToGdbHex(reply, data.data(), len); MemToGdbHex(reply, data.data(), len);
reply[len * 2] = '\0'; reply[len * 2] = '\0';
@ -914,7 +915,8 @@ static bool CommitBreakpoint(BreakpointType type, VAddr addr, u32 len) {
breakpoint.active = true; breakpoint.active = true;
breakpoint.addr = addr; breakpoint.addr = addr;
breakpoint.len = len; 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<u8, 4> btrap{0x70, 0x00, 0x20, 0xe1}; static constexpr std::array<u8, 4> btrap{0x70, 0x00, 0x20, 0xe1};
Memory::WriteBlock(addr, btrap.data(), btrap.size()); Memory::WriteBlock(addr, btrap.data(), btrap.size());
Core::CPU().ClearInstructionCache(); Core::CPU().ClearInstructionCache();

View File

@ -801,7 +801,7 @@ void SVC::OutputDebugString(VAddr address, s32 len) {
} }
std::string string(len, ' '); std::string string(len, ' ');
Memory::ReadBlock(address, string.data(), len); Memory::ReadBlock(*kernel.GetCurrentProcess(), address, string.data(), len);
LOG_DEBUG(Debug_Emulated, "{}", string); LOG_DEBUG(Debug_Emulated, "{}", string);
} }

View File

@ -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) { void Write8(const VAddr addr, const u8 data) {
Write<u8>(addr, data); Write<u8>(addr, data);
} }

View File

@ -197,7 +197,6 @@ void Write32(VAddr addr, u32 data);
void Write64(VAddr addr, u64 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(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, void WriteBlock(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer,
std::size_t size); std::size_t size);
void WriteBlock(VAddr dest_addr, const void* src_buffer, std::size_t size); void WriteBlock(VAddr dest_addr, const void* src_buffer, std::size_t size);

View File

@ -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 // 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.SetPacketDataSize(data_size);
packet.SendReply(); packet.SendReply();
} }