From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HwD09-0003ya-8p for qemu-devel@nongnu.org; Thu, 07 Jun 2007 04:05:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HwD07-0003wQ-BL for qemu-devel@nongnu.org; Thu, 07 Jun 2007 04:05:48 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HwD07-0003wC-4E for qemu-devel@nongnu.org; Thu, 07 Jun 2007 04:05:47 -0400 Received: from hu-out-0506.google.com ([72.14.214.229]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HwD05-0005gg-TP for qemu-devel@nongnu.org; Thu, 07 Jun 2007 04:05:46 -0400 Received: by hu-out-0506.google.com with SMTP id 20so265399huc for ; Thu, 07 Jun 2007 01:05:38 -0700 (PDT) Message-ID: Date: Thu, 7 Jun 2007 16:05:37 +0800 From: "Jun Peng" Subject: Re: [Qemu-devel] qemu on mips patch MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_32415_24121662.1181203537298" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ------=_Part_32415_24121662.1181203537298 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 2007/6/3, Thiemo Seufer : > ... I think the current > CVS version does the right thing without relying on on an equivalent > to your op_mips.c tool. > ... On my computer, I do not think so. in op.o, -fno-PIC -mno-abicalls 004eb0d4 : ... 4eb104: afa50010 sw a1,16(sp) 4eb108: 14600003 bnez v1,4eb118 4eb10c: 00000000 nop 4eb110: 0c140e12 jal 503848 4eb114: 00000000 nop 4eb118: 8fa30010 lw v1,16(sp) 4eb11c: 00002021 move a0,zero in helper.o, PIC and abicalls 00503848 : 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 op_divb_AL_T0() calls raise_exception(), $t9 is not address of raise_exception(). in op.h case INDEX_op_divb_AL_T0: { ... /* R_MIPS_26 RELOC, offset 0x10d0, name raise_exception */ *(uint32_t *)(gen_code_ptr + 0x3c) = (0xc000000 & ~0x3fffff) | ((0xc000000 + (((long)(&raise_exception) - (*(uint32_t *)(gen_code_ptr + 0x3c))) >> 2)) & 0x3fffff); jal(R_MIPS_26) is a PC-region branch, not PC-relative. ------=_Part_32415_24121662.1181203537298 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
2007/6/3, Thiemo Seufer <ths@networkno.de>:
> ... I think the current
> CVS version does the right thing without relying on on an equivalent
> to your op_mips.c tool.
> ...


On my computer, I do not think so.

in 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

in 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 op_divb_AL_T0() calls raise_exception(), $t9 is not address of raise_exception().

in op.h
case INDEX_op_divb_AL_T0: {
...
    /* R_MIPS_26 RELOC, offset 0x10d0, name raise_exception */
    *(uint32_t *)(gen_code_ptr + 0x3c) = (0xc000000 & ~0x3fffff) | ((0xc000000 + (((long)(&raise_exception) - (*(uint32_t *)(gen_code_ptr + 0x3c))) >> 2))    & 0x3fffff);

jal(R_MIPS_26) is a PC-region branch, not PC-relative.
------=_Part_32415_24121662.1181203537298--