mirror of
https://github.com/shadergz/cosmic-station.git
synced 2024-11-23 06:09:40 +00:00
EE
: We dont need to store the diff. between the generated cycles
This commit is contained in:
parent
05e2d5b5ed
commit
4dae7d20f0
@ -163,7 +163,7 @@ namespace cosmic::creeper {
|
||||
isCached = true;
|
||||
}
|
||||
if (!isCached || !chosen || !chosen->isLoaded) {
|
||||
throw AppErr("No translated block was created or found; there is a bug in the code");
|
||||
throw AppErr("No translated block was created or found");
|
||||
}
|
||||
runFasterBlock(PCs[0], PCs[1]);
|
||||
executionPipe[0] = cpu->runCycles;
|
||||
|
@ -29,7 +29,7 @@ namespace cosmic::creeper {
|
||||
return static_cast<EffectivePipeline>(static_cast<u16>(dest) ^ static_cast<u16>(src));
|
||||
}
|
||||
};
|
||||
enum InstructionExtraCycles: i16 {
|
||||
enum InstructionExtraCycles: u32 {
|
||||
None = 0,
|
||||
Div = 37,
|
||||
Mul = 4
|
||||
|
@ -158,8 +158,8 @@ namespace cosmic::creeper {
|
||||
getOpcodeHandler(ivCore, coreOps, microCodes, set);
|
||||
|
||||
if (!microCodes.execute) {
|
||||
microCodes.execute = [&](Operands& err) {
|
||||
throw AppErr("Currently, we cannot handle the operation {:#x} at PC address {:#x}", err.inst, actualPc);
|
||||
microCodes.execute = [](Operands& err) {
|
||||
throw AppErr("Currently, we cannot handle the operation {:#x} at PC address {:#x}", err.inst, static_cast<u32>(cpu->eePc));
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
@ -30,12 +30,11 @@ namespace cosmic::ee {
|
||||
vst1_u64_x4(gprs + regRange + 4, zero);
|
||||
vst1_u64_x4(gprs + regRange + 6, zero);
|
||||
}
|
||||
runCycles = cycles[0] = 0;
|
||||
runCycles = {};
|
||||
user->info("(EE): Emotion Engine is finally reset to default, "
|
||||
"GPR {}: {}", eeAllGprIdentifier[15], fmt::join(GPRs[15].dw, ", "));
|
||||
}
|
||||
void EeMipsCore::pulse(u32 cycles) {
|
||||
this->cycles[0] = cycles;
|
||||
cop0.count += cycles;
|
||||
if (!irqTrigger) {
|
||||
const i64 beforeInc{runCycles};
|
||||
@ -55,35 +54,6 @@ namespace cosmic::ee {
|
||||
}
|
||||
}
|
||||
}
|
||||
template <typename T>
|
||||
T EeMipsCore::mipsRead(u32 address) {
|
||||
const u32 virt{address / 4096};
|
||||
const auto page{cop0.virtMap[virt]};
|
||||
const auto br{page == first};
|
||||
if (br) {
|
||||
if constexpr (sizeof(T) == 4) {
|
||||
return PipeRead<T>(memPipe, address & 0x1fffffff);
|
||||
}
|
||||
} else if (page > first) {
|
||||
return *PipeCraftPtr<T*>(memPipe, address & 0xfff);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
template<typename T>
|
||||
void EeMipsCore::mipsWrite(u32 address, T value) {
|
||||
const u32 pn{address / 4096};
|
||||
const u8* page{cop0.virtMap[pn]};
|
||||
[[unlikely]] if (page == first) {
|
||||
cop0.virtCache->tlbChangeModified(pn, true);
|
||||
|
||||
PipeWrite<T>(memPipe, address & 0x1fffffff, value);
|
||||
} else if (page > first) {
|
||||
|
||||
auto target{PipeCraftPtr<T*>(memPipe, address & 0xfff)};
|
||||
*target = value;
|
||||
}
|
||||
invalidateExecRegion(address);
|
||||
}
|
||||
|
||||
u32 EeMipsCore::fetchByPc() {
|
||||
const u32 orderPC{lastPc};
|
||||
|
@ -52,10 +52,34 @@ namespace cosmic::ee {
|
||||
const u8* first{reinterpret_cast<u8*>(1)};
|
||||
|
||||
template <typename T>
|
||||
T mipsRead(u32 address);
|
||||
|
||||
T mipsRead(u32 address) {
|
||||
const u32 virt{address / 4096};
|
||||
const auto page{cop0.virtMap[virt]};
|
||||
const auto br{page == first};
|
||||
if (br) {
|
||||
if constexpr (sizeof(T) == 4) {
|
||||
return PipeRead<T>(memPipe, address & 0x1fffffff);
|
||||
}
|
||||
} else if (page > first) {
|
||||
return *PipeCraftPtr<T*>(memPipe, address & 0xfff);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
template<typename T>
|
||||
void mipsWrite(u32 address, T value);
|
||||
void mipsWrite(u32 address, T value) {
|
||||
const u32 pn{address / 4096};
|
||||
const u8* page{cop0.virtMap[pn]};
|
||||
[[unlikely]] if (page == first) {
|
||||
cop0.virtCache->tlbChangeModified(pn, true);
|
||||
|
||||
PipeWrite<T>(memPipe, address & 0x1fffffff, value);
|
||||
} else if (page > first) {
|
||||
|
||||
auto target{PipeCraftPtr<T*>(memPipe, address & 0xfff)};
|
||||
*target = value;
|
||||
}
|
||||
invalidateExecRegion(address);
|
||||
}
|
||||
|
||||
inline u32 incPc() {
|
||||
chPc(eePc);
|
||||
@ -90,8 +114,7 @@ namespace cosmic::ee {
|
||||
}
|
||||
bool isABranch{};
|
||||
u32 delaySlot{};
|
||||
i64 cycles[1],
|
||||
runCycles;
|
||||
u32 runCycles;
|
||||
|
||||
ExecutionMode cpuMode{ExecutionMode::CachedInterpreter};
|
||||
CtrlCop cop0;
|
||||
|
Loading…
Reference in New Issue
Block a user