Small tweaks to rel2 logging.

This commit is contained in:
Unknown W. Brackets 2013-12-08 22:30:30 -08:00
parent bd1d4e2d92
commit 2b10fbae1e

View file

@ -305,8 +305,8 @@ void ElfReader::LoadRelocations2(int rel_seg)
ERROR_LOG_REPORT(LOADER, "Rel2: invalid lo16 type! %x", flag);
}
op = Memory::ReadUnchecked_U32(rel_offset);
DEBUG_LOG(LOADER, "Rel2: %5d: CMD=0x%04X type=%d off_seg=%d offset=%08x addr_seg=%d op=%08x\n", rcount, cmd, type, off_seg, rel_base, addr_seg, op);
op = Memory::Read_Instruction(rel_offset).encoding;
DEBUG_LOG(LOADER, "Rel2: %5d: CMD=0x%04X flag=%x type=%d off_seg=%d offset=%08x addr_seg=%d op=%08x\n", rcount, cmd, flag, type, off_seg, rel_base, addr_seg, op);
switch(type){
case 0:
@ -318,6 +318,11 @@ void ElfReader::LoadRelocations2(int rel_seg)
case 6: // R_MIPS_J26
case 7: // R_MIPS_JAL26
op = (op&0xFC000000) | (((op&0x03FFFFFF)+(relocate_to>>2))&0x03FFFFFF);
// To be safe, let's force it to the specified jump.
if (type == 6)
op = (op & ~0xFC000000) | 0x08000000;
else if (type == 7)
op = (op & ~0xFC000000) | 0x0C000000;
break;
case 4: // R_MIPS_HI16
addr = ((op<<16)+lo16)+relocate_to;
@ -330,6 +335,7 @@ void ElfReader::LoadRelocations2(int rel_seg)
op = (op&0xffff0000) | (((op&0xffff)+relocate_to)&0xffff);
break;
default:
ERROR_LOG_REPORT(LOADER, "Rel2: unexpected relocation type! %x", type);
break;
}