mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 06:05:40 +12:00
CRO: Lighter icache flushes
This commit is contained in:
parent
0c6c455d4d
commit
33c3e67b31
4 changed files with 12 additions and 9 deletions
|
@ -181,5 +181,7 @@ class CPU {
|
||||||
void addTicks(u64 ticks) { env.AddTicks(ticks); }
|
void addTicks(u64 ticks) { env.AddTicks(ticks); }
|
||||||
|
|
||||||
void clearCache() { jit->ClearCache(); }
|
void clearCache() { jit->ClearCache(); }
|
||||||
|
void clearCacheRange(u32 start, u32 size) { jit->InvalidateCacheRange(start, size); }
|
||||||
|
|
||||||
void runFrame();
|
void runFrame();
|
||||||
};
|
};
|
|
@ -250,4 +250,5 @@ public:
|
||||||
|
|
||||||
void sendGPUInterrupt(GPUInterrupt type) { serviceManager.sendGPUInterrupt(type); }
|
void sendGPUInterrupt(GPUInterrupt type) { serviceManager.sendGPUInterrupt(type); }
|
||||||
void clearInstructionCache();
|
void clearInstructionCache();
|
||||||
|
void clearInstructionCacheRange(u32 start, u32 size);
|
||||||
};
|
};
|
|
@ -298,6 +298,7 @@ void Kernel::duplicateHandle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Kernel::clearInstructionCache() { cpu.clearCache(); }
|
void Kernel::clearInstructionCache() { cpu.clearCache(); }
|
||||||
|
void Kernel::clearInstructionCacheRange(u32 start, u32 size) { cpu.clearCacheRange(start, size); }
|
||||||
|
|
||||||
namespace SystemInfoType {
|
namespace SystemInfoType {
|
||||||
enum : u32 {
|
enum : u32 {
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace CROHeader {
|
||||||
NameOffset = 0x084,
|
NameOffset = 0x084,
|
||||||
NextCRO = 0x088,
|
NextCRO = 0x088,
|
||||||
PrevCRO = 0x08C,
|
PrevCRO = 0x08C,
|
||||||
|
FixedSize = 0x98,
|
||||||
OnUnresolved = 0x0AC,
|
OnUnresolved = 0x0AC,
|
||||||
CodeOffset = 0x0B0,
|
CodeOffset = 0x0B0,
|
||||||
DataOffset = 0x0B8,
|
DataOffset = 0x0B8,
|
||||||
|
@ -167,6 +168,10 @@ public:
|
||||||
return mem.read32(croPointer + CROHeader::PrevCRO);
|
return mem.read32(croPointer + CROHeader::PrevCRO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 getFixedSize() {
|
||||||
|
return mem.read32(croPointer + CROHeader::FixedSize);
|
||||||
|
}
|
||||||
|
|
||||||
void setNextCRO(u32 nextCRO) {
|
void setNextCRO(u32 nextCRO) {
|
||||||
mem.write32(croPointer + CROHeader::NextCRO, nextCRO);
|
mem.write32(croPointer + CROHeader::NextCRO, nextCRO);
|
||||||
}
|
}
|
||||||
|
@ -1248,8 +1253,7 @@ void LDRService::initialize(u32 messagePointer) {
|
||||||
Helpers::panic("Failed to rebase CRS");
|
Helpers::panic("Failed to rebase CRS");
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel.clearInstructionCache();
|
kernel.clearInstructionCacheRange(mapVaddr, size);
|
||||||
|
|
||||||
loadedCRS = mapVaddr;
|
loadedCRS = mapVaddr;
|
||||||
|
|
||||||
mem.write32(messagePointer, IPC::responseHeader(0x1, 1, 0));
|
mem.write32(messagePointer, IPC::responseHeader(0x1, 1, 0));
|
||||||
|
@ -1278,8 +1282,6 @@ void LDRService::linkCRO(u32 messagePointer) {
|
||||||
Helpers::panic("Failed to link CRO");
|
Helpers::panic("Failed to link CRO");
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel.clearInstructionCache();
|
|
||||||
|
|
||||||
mem.write32(messagePointer, IPC::responseHeader(0x6, 1, 0));
|
mem.write32(messagePointer, IPC::responseHeader(0x6, 1, 0));
|
||||||
mem.write32(messagePointer + 4, Result::Success);
|
mem.write32(messagePointer + 4, Result::Success);
|
||||||
}
|
}
|
||||||
|
@ -1346,8 +1348,7 @@ void LDRService::loadCRO(u32 messagePointer, bool isNew) {
|
||||||
|
|
||||||
// TODO: add fixing
|
// TODO: add fixing
|
||||||
cro.fix(fixLevel);
|
cro.fix(fixLevel);
|
||||||
|
kernel.clearInstructionCacheRange(mapVaddr, size);
|
||||||
kernel.clearInstructionCache();
|
|
||||||
|
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
mem.write32(messagePointer, IPC::responseHeader(0x9, 2, 0));
|
mem.write32(messagePointer, IPC::responseHeader(0x9, 2, 0));
|
||||||
|
@ -1377,7 +1378,6 @@ void LDRService::unloadCRO(u32 messagePointer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CRO cro(mem, mapVaddr, true);
|
CRO cro(mem, mapVaddr, true);
|
||||||
|
|
||||||
cro.unregisterCRO(loadedCRS);
|
cro.unregisterCRO(loadedCRS);
|
||||||
|
|
||||||
if (!cro.unlink(loadedCRS)) {
|
if (!cro.unlink(loadedCRS)) {
|
||||||
|
@ -1388,8 +1388,7 @@ void LDRService::unloadCRO(u32 messagePointer) {
|
||||||
Helpers::panic("Failed to unrebase CRO");
|
Helpers::panic("Failed to unrebase CRO");
|
||||||
}
|
}
|
||||||
|
|
||||||
kernel.clearInstructionCache();
|
kernel.clearInstructionCacheRange(mapVaddr, cro.getFixedSize());
|
||||||
|
|
||||||
mem.write32(messagePointer, IPC::responseHeader(0x5, 1, 0));
|
mem.write32(messagePointer, IPC::responseHeader(0x5, 1, 0));
|
||||||
mem.write32(messagePointer + 4, Result::Success);
|
mem.write32(messagePointer + 4, Result::Success);
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue