Fix mftbu returning the wrong half of the timebase register.

This commit is contained in:
Andrew Church 2015-01-18 07:03:48 +09:00
parent 74cbf1877b
commit bbe12bf4b1
2 changed files with 3 additions and 12 deletions

View file

@ -148,7 +148,7 @@ private:
case 0x103: return CPU.SPRG[3]; case 0x103: return CPU.SPRG[3];
case 0x10C: CPU.TB = get_time(); return CPU.TB; case 0x10C: CPU.TB = get_time(); return CPU.TB;
case 0x10D: CPU.TB = get_time(); return CPU.TBH; case 0x10D: CPU.TB = get_time(); return CPU.TB >> 32;
case 0x110: case 0x110:
case 0x111: case 0x111:
@ -2884,7 +2884,7 @@ private:
switch(n) switch(n)
{ {
case 0x10C: CPU.GPR[rd] = CPU.TB; break; case 0x10C: CPU.GPR[rd] = CPU.TB; break;
case 0x10D: CPU.GPR[rd] = CPU.TBH; break; case 0x10D: CPU.GPR[rd] = CPU.TB >> 32; break;
default: throw fmt::Format("mftb r%d, %d", rd, spr); default: throw fmt::Format("mftb r%d, %d", rd, spr);
} }
} }

View file

@ -542,17 +542,8 @@ public:
u64 SPRG[8]; //SPR 0x110 - 0x117 : SPR General-Purpose Registers u64 SPRG[8]; //SPR 0x110 - 0x117 : SPR General-Purpose Registers
//TBR : Time-Base Registers //TBR : Time-Base Registers
union
{
u64 TB; //TBR 0x10C - 0x10D u64 TB; //TBR 0x10C - 0x10D
struct
{
u32 TBH;
u32 TBL;
};
};
u64 cycle; u64 cycle;
u64 R_ADDR; // reservation address u64 R_ADDR; // reservation address