mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Memory: remove WriteBlock with current process
This commit is contained in:
		
							parent
							
								
									8871f5a4ac
								
							
						
					
					
						commit
						4e99641a3b
					
				
					 5 changed files with 10 additions and 11 deletions
				
			
		|  | @ -409,7 +409,8 @@ static void RemoveBreakpoint(BreakpointType type, VAddr addr) { | |||
| 
 | ||||
|     LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:08x} bytes at {:08x} of type {}", | ||||
|               bp->second.len, bp->second.addr, static_cast<int>(type)); | ||||
|     Memory::WriteBlock(bp->second.addr, bp->second.inst.data(), bp->second.inst.size()); | ||||
|     Memory::WriteBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), bp->second.addr, | ||||
|                        bp->second.inst.data(), bp->second.inst.size()); | ||||
|     Core::CPU().ClearInstructionCache(); | ||||
|     p.erase(addr); | ||||
| } | ||||
|  | @ -862,7 +863,8 @@ static void WriteMemory() { | |||
|     std::vector<u8> data(len); | ||||
| 
 | ||||
|     GdbHexToMem(data.data(), len_pos + 1, len); | ||||
|     Memory::WriteBlock(addr, data.data(), len); | ||||
|     Memory::WriteBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), addr, data.data(), | ||||
|                        len); | ||||
|     Core::CPU().ClearInstructionCache(); | ||||
|     SendReply("OK"); | ||||
| } | ||||
|  | @ -918,7 +920,8 @@ static bool CommitBreakpoint(BreakpointType type, VAddr addr, u32 len) { | |||
|     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}; | ||||
|     Memory::WriteBlock(addr, btrap.data(), btrap.size()); | ||||
|     Memory::WriteBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), addr, | ||||
|                        btrap.data(), btrap.size()); | ||||
|     Core::CPU().ClearInstructionCache(); | ||||
|     p.insert({addr, breakpoint}); | ||||
| 
 | ||||
|  |  | |||
|  | @ -437,7 +437,8 @@ private: | |||
|      */ | ||||
|     template <typename T> | ||||
|     void SetEntry(std::size_t index, const T& data) { | ||||
|         Memory::WriteBlock(GetField(T::TABLE_OFFSET_FIELD) + static_cast<u32>(index * sizeof(T)), | ||||
|         Memory::WriteBlock(process, | ||||
|                            GetField(T::TABLE_OFFSET_FIELD) + static_cast<u32>(index * sizeof(T)), | ||||
|                            &data, sizeof(T)); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -547,11 +547,6 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void WriteBlock(const VAddr dest_addr, const void* src_buffer, const std::size_t size) { | ||||
|     WriteBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), dest_addr, src_buffer, | ||||
|                size); | ||||
| } | ||||
| 
 | ||||
| void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const std::size_t size) { | ||||
|     auto& page_table = process.vm_manager.page_table; | ||||
|     std::size_t remaining_size = size; | ||||
|  |  | |||
|  | @ -199,7 +199,6 @@ void Write64(VAddr addr, u64 data); | |||
| void ReadBlock(const Kernel::Process& process, 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); | ||||
| void ZeroBlock(const Kernel::Process& process, VAddr dest_addr, const std::size_t size); | ||||
| void ZeroBlock(VAddr dest_addr, const std::size_t size); | ||||
| void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, std::size_t size); | ||||
|  |  | |||
|  | @ -41,7 +41,8 @@ void RPCServer::HandleWriteMemory(Packet& packet, u32 address, const u8* data, u | |||
|         (address >= Memory::HEAP_VADDR && address <= Memory::HEAP_VADDR_END) || | ||||
|         (address >= Memory::N3DS_EXTRA_RAM_VADDR && address <= Memory::N3DS_EXTRA_RAM_VADDR_END)) { | ||||
|         // Note: Memory write occurs asynchronously from the state of the emulator
 | ||||
|         Memory::WriteBlock(address, data, data_size); | ||||
|         Memory::WriteBlock(*Core::System::GetInstance().Kernel().GetCurrentProcess(), address, data, | ||||
|                            data_size); | ||||
|         // If the memory happens to be executable code, make sure the changes become visible
 | ||||
|         Core::CPU().InvalidateCacheRange(address, data_size); | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue