ldr_ro: Use ranged instruction cache invalidation
This commit is contained in:
parent
647e553f64
commit
a9af4be363
@ -5,6 +5,8 @@
|
||||
#include "common/alignment.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "core/arm/arm_interface.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/service/ldr_ro/cro_helper.h"
|
||||
|
||||
namespace Service {
|
||||
@ -61,9 +63,11 @@ ResultCode CROHelper::ApplyRelocation(VAddr target_address, RelocationType reloc
|
||||
case RelocationType::AbsoluteAddress:
|
||||
case RelocationType::AbsoluteAddress2:
|
||||
Memory::Write32(target_address, symbol_address + addend);
|
||||
Core::CPU().InvalidateCacheRange(target_address, sizeof(u32));
|
||||
break;
|
||||
case RelocationType::RelativeAddress:
|
||||
Memory::Write32(target_address, symbol_address + addend - target_future_address);
|
||||
Core::CPU().InvalidateCacheRange(target_address, sizeof(u32));
|
||||
break;
|
||||
case RelocationType::ThumbBranch:
|
||||
case RelocationType::ArmBranch:
|
||||
@ -86,6 +90,7 @@ ResultCode CROHelper::ClearRelocation(VAddr target_address, RelocationType reloc
|
||||
case RelocationType::AbsoluteAddress2:
|
||||
case RelocationType::RelativeAddress:
|
||||
Memory::Write32(target_address, 0);
|
||||
Core::CPU().InvalidateCacheRange(target_address, sizeof(u32));
|
||||
break;
|
||||
case RelocationType::ThumbBranch:
|
||||
case RelocationType::ArmBranch:
|
||||
|
@ -439,7 +439,7 @@ static void LoadCRO(Interface* self, bool link_on_load_bug_fix) {
|
||||
}
|
||||
}
|
||||
|
||||
Core::CPU().ClearInstructionCache();
|
||||
Core::CPU().InvalidateCacheRange(cro_address, cro_size);
|
||||
|
||||
LOG_INFO(Service_LDR, "CRO \"%s\" loaded at 0x%08X, fixed_end=0x%08X", cro.ModuleName().data(),
|
||||
cro_address, cro_address + fix_size);
|
||||
@ -535,7 +535,7 @@ static void UnloadCRO(Interface* self) {
|
||||
memory_synchronizer.RemoveMemoryBlock(cro_address, cro_buffer_ptr);
|
||||
}
|
||||
|
||||
Core::CPU().ClearInstructionCache();
|
||||
Core::CPU().InvalidateCacheRange(cro_address, fixed_size);
|
||||
|
||||
rb.Push(result);
|
||||
}
|
||||
@ -588,7 +588,6 @@ static void LinkCRO(Interface* self) {
|
||||
}
|
||||
|
||||
memory_synchronizer.SynchronizeOriginalMemory();
|
||||
Core::CPU().ClearInstructionCache();
|
||||
|
||||
rb.Push(result);
|
||||
}
|
||||
@ -641,7 +640,6 @@ static void UnlinkCRO(Interface* self) {
|
||||
}
|
||||
|
||||
memory_synchronizer.SynchronizeOriginalMemory();
|
||||
Core::CPU().ClearInstructionCache();
|
||||
|
||||
rb.Push(result);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user