qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] HOST_MIPS: handle relocation of op.o (op_mips.c, patch)


From: Jun Peng
Subject: [Qemu-devel] HOST_MIPS: handle relocation of op.o (op_mips.c, patch)
Date: Tue, 12 Jun 2007 22:57:04 +0800

Hello,

Let us see "jal R_MIPS_26":
in current CVS version, op.o, -fno-PIC -mno-abicalls
004eb0d4 <op_divb_AL_T0>:
...
 4eb104: afa50010 sw a1,16(sp)
 4eb108: 14600003 bnez v1,4eb118 <op_divb_AL_T0+0x44>
 4eb10c: 00000000 nop
 4eb110: 0c140e12 jal 503848 <raise_exception>
 4eb114: 00000000 nop
 4eb118: 8fa30010 lw v1,16(sp)
 4eb11c: 00002021 move a0,zero

helper.o, PIC and abicalls
00503848 <raise_exception>:
 503848: 3c1c000c lui gp,0xc
 50384c: 279c0858 addiu gp,gp,2136
 503850: 0399e021 addu gp,gp,t9
 503854: 8f998db8 lw t9,-29256(gp)
 503858: 00002821 move a1,zero
 50385c: 00003021 move a2,zero
 503860: 03200008 jr t9
 503864: 00003821 move a3,zero


When calling PIC/abicalls functions, $25 must contain the address of
the called function. But, At 0x503850, I guess $25 is not
&raise_exception, but &gen_func.

Therefore, before call raise_exception, we must seved the address of
raise_exception into $25. In other words, we must use R_MIPS_HI16 /
R_MIPS_LO16 instead of R_MIPS_26. op_mips.c can take care of this. I
tested it with qemu-0.6.1 and qemu-0.9.0 on loongson + linux.

Attachment: qemu-op_mips.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]