ldr_ro: Use ranged instruction cache invalidation

This commit is contained in:
MerryMage 2017-09-11 13:00:14 +01:00
parent 647e553f64
commit a9af4be363
2 changed files with 7 additions and 4 deletions

View file

@ -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:

View file

@ -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);
}