Compute the target of the jump in the 'J' and 'JAL' instructions

correctly. The 256MB segment is formed by taking the top 4 bits
of the address of the instruction in the "branch delay" slot
as opposed to the 'J' or 'JAL' instruction itself.

Approved by: imp (mentor)
This commit is contained in:
neel 2010-01-09 02:17:14 +00:00
parent f7c48f09b3
commit a3e02917f3

View File

@ -1091,7 +1091,7 @@ MipsEmulateBranch(struct trapframe *framePtr, uintptr_t instPC, int fpcCSR,
case OP_J:
case OP_JAL:
retAddr = (inst.JType.target << 2) |
((unsigned)instPC & 0xF0000000);
((unsigned)(instPC + 4) & 0xF0000000);
break;
case OP_BEQ: