core: arm: Implement InvalidateCacheRange for CPU cache invalidation.
This commit is contained in:
parent
c0870315fd
commit
63fd1bb503
12 changed files with 56 additions and 16 deletions
|
@ -497,12 +497,17 @@ const Core::ExclusiveMonitor& KernelCore::GetExclusiveMonitor() const {
|
|||
}
|
||||
|
||||
void KernelCore::InvalidateAllInstructionCaches() {
|
||||
if (!IsMulticore()) {
|
||||
for (auto& physical_core : impl->cores) {
|
||||
physical_core.ArmInterface().ClearInstructionCache();
|
||||
for (auto& physical_core : impl->cores) {
|
||||
physical_core.ArmInterface().ClearInstructionCache();
|
||||
}
|
||||
}
|
||||
|
||||
void KernelCore::InvalidateCpuInstructionCacheRange(VAddr addr, std::size_t size) {
|
||||
for (auto& physical_core : impl->cores) {
|
||||
if (!physical_core.IsInitialized()) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
UNIMPLEMENTED();
|
||||
physical_core.ArmInterface().InvalidateCacheRange(addr, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,6 +156,8 @@ public:
|
|||
|
||||
void InvalidateAllInstructionCaches();
|
||||
|
||||
void InvalidateCpuInstructionCacheRange(VAddr addr, std::size_t size);
|
||||
|
||||
/// Adds a port to the named port table
|
||||
void AddNamedPort(std::string name, std::shared_ptr<ClientPort> port);
|
||||
|
||||
|
|
|
@ -670,6 +670,11 @@ ResultCode PageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size, Memo
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
if ((prev_perm & MemoryPermission::Execute) != (perm & MemoryPermission::Execute)) {
|
||||
// Memory execution state is changing, invalidate CPU cache range
|
||||
system.InvalidateCpuInstructionCacheRange(addr, size);
|
||||
}
|
||||
|
||||
const std::size_t num_pages{size / PageSize};
|
||||
const OperationType operation{(perm & MemoryPermission::Execute) != MemoryPermission::None
|
||||
? OperationType::ChangePermissionsAndRefresh
|
||||
|
|
|
@ -58,6 +58,10 @@ public:
|
|||
// Shutdown this physical core.
|
||||
void Shutdown();
|
||||
|
||||
bool IsInitialized() const {
|
||||
return arm_interface != nullptr;
|
||||
}
|
||||
|
||||
Core::ARM_Interface& ArmInterface() {
|
||||
return *arm_interface;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue