Re: [Qemu-devel] qemu on mips patch

2007-06-07 Thread Jun Peng

2007/6/3, Thiemo Seufer [EMAIL PROTECTED]:

... 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: 1463 bnez v1,4eb118 op_divb_AL_T0+0x44
 4eb10c:  nop
 4eb110: 0c140e12 jal 503848 raise_exception
 4eb114:  nop
 4eb118: 8fa30010 lw v1,16(sp)
 4eb11c: 2021 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: 2821 move a1,zero
 50385c: 3021 move a2,zero
 503860: 0328 jr t9
 503864: 3821 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) = (0xc00  ~0x3f) |
((0xc00 + (((long)(raise_exception) - (*(uint32_t *)(gen_code_ptr +
0x3c)))  2)) 0x3f);

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


Re: [Qemu-devel] qemu on mips patch

2007-06-03 Thread Thiemo Seufer
Jun Peng wrote:
 Hello!
 
 Are you are just testing host_mips qemu? I have been doing the same
 work two or three month
 
 ago on a mips + linux system. But, it have some bugs however.
 
 It is for qemu 0.6.1 refer to qemu-irix.patch at first. And yesterday,
 I made a qemu 0.9.0

 patch. It seems working(only target-i386). In order to handle
 relocation symbol, I writed a
 
 little tool named op_mips.c. This tool is the key of my patch.

In the meanwhile the latest CVS qemu has preliminary mips host support,
could you refresh you patch to the latest version? I think the current
CVS version does the right thing without relying on on an equivalent
to your op_mips.c tool.

Also, a patch for the errno handling on mips went just in, please
write your version for x86 in the same style, and split it out in a
separate patch.


Thiemo




Re: [Qemu-devel] qemu on mips patch

2007-06-02 Thread Jun Peng

Sorry, sorry, I did send a wrony cpu_signal_handler()!

in cpu-exec.c:

#include sys/user.h
int cpu_signal_handler(int host_signum, void *pinfo,
  void *puc)
{
   siginfo_t *info = pinfo;
   struct ucontext *uc = puc;
   unsigned long pc;
   int is_write;

   pc = uc-uc_mcontext.pc;
   /* XXX: compute is_write */
   is_write = 0;
   return handle_cpu_signal(pc, (unsigned long)info-si_addr,
is_write,
uc-uc_sigmask, puc);
}