mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-24 12:30:05 +00:00
ppcopcodes: fix timebase read & write.
This commit is contained in:
parent
f5e8c9cbb8
commit
0eb557751b
@ -1320,12 +1320,12 @@ void ppc_mtspr() {
|
|||||||
switch (ref_spr) {
|
switch (ref_spr) {
|
||||||
//Mirror the TBRs in the SPR range to the user-mode TBRs.
|
//Mirror the TBRs in the SPR range to the user-mode TBRs.
|
||||||
case 284:
|
case 284:
|
||||||
ppc_state.ppc_spr[284] = (uint32_t)timebase_counter;
|
timebase_counter = (timebase_counter & 0xFFFFFFFF00000000ULL) +
|
||||||
ppc_state.ppc_tbr[TBR::TBL] = (uint32_t)timebase_counter;
|
ppc_state.ppc_gpr[reg_s];
|
||||||
break;
|
break;
|
||||||
case 285:
|
case 285:
|
||||||
ppc_state.ppc_spr[285] = (uint32_t)(timebase_counter >> 32);
|
timebase_counter = (timebase_counter & 0x00000000FFFFFFFFULL) +
|
||||||
ppc_state.ppc_tbr[TBR::TBU] = (uint32_t)(timebase_counter >> 32);
|
(((uint64_t)(ppc_state.ppc_gpr[reg_s])) << 32);
|
||||||
break;
|
break;
|
||||||
case 528:
|
case 528:
|
||||||
case 529:
|
case 529:
|
||||||
@ -1354,10 +1354,10 @@ void ppc_mftb() {
|
|||||||
reg_d = (ppc_cur_instruction >> 21) & 31;
|
reg_d = (ppc_cur_instruction >> 21) & 31;
|
||||||
switch (ref_spr) {
|
switch (ref_spr) {
|
||||||
case 268:
|
case 268:
|
||||||
ppc_state.ppc_gpr[reg_d] = ppc_state.ppc_tbr[TBR::TBL];
|
ppc_state.ppc_gpr[reg_d] = timebase_counter & 0xFFFFFFFFUL;
|
||||||
break;
|
break;
|
||||||
case 269:
|
case 269:
|
||||||
ppc_state.ppc_gpr[reg_d] = ppc_state.ppc_tbr[TBR::TBU];
|
ppc_state.ppc_gpr[reg_d] = (timebase_counter >> 32) & 0xFFFFFFFFUL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cout << "Invalid TBR access attempted!" << std::endl;
|
std::cout << "Invalid TBR access attempted!" << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user