qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] MIPS64 problem with ethernet


From: Aurelien Jarno
Subject: Re: [Qemu-devel] MIPS64 problem with ethernet
Date: Sat, 26 May 2007 23:18:45 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Mon, May 21, 2007 at 10:49:12AM -0500, Jason Wessel wrote:
> Aurelien Jarno wrote:
> >Jason Wessel a écrit :
> >  
> >>The ethernet device does not come up correctly on a 64 MIPS target with 
> >>a 64 bit kernel.
> >>    
> >
> >Which Ethernet card are you using? The pcnet one is working correctly
> >here. I am using a 2.6.21.1 kernel.
> >
> >  
> It works perfectly fine if I boot a 32bit kernel on the 64bit mips qemu 
> with the pcnet32.  It is when I boot the 64bit kernel on the 64bit mips 
> qemu that I see the issue.  The only difference I can see is the math 
> operations in the kcalloc() inline because the sizes are different in 32 
> vs 64 of course.  I too was using a 2.6.21.1 kernel with mips.org 
> patches.  Likely that I am using a different compiler though.  Keeping 
> in mind that the same kernel 32bit and 64bit kernels works fine on real 
> hardware.
> 

As discussed on IRC, the problem is only present on 32-bit hosts. It is
due to the do_ddivu which is falsely implemented using lldiv and then by
casting the result. The patch below uses / and % as on the 64-bit host
code. It is maybe slower than lldiv, but at least it gives the correct
result. This probably involves some libgcc code, so it is better to keep
it in op_helper.c for 32-bit hosts.

Index: target-mips/op_helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-mips/op_helper.c,v
retrieving revision 1.49
diff -u -d -p -r1.49 op_helper.c
--- target-mips/op_helper.c     20 May 2007 13:27:58 -0000      1.49
+++ target-mips/op_helper.c     25 May 2007 14:57:23 -0000
@@ -240,10 +240,8 @@ void do_ddiv (void)
 void do_ddivu (void)
 {
     if (T1 != 0) {
-        /* XXX: lldivu? */
-        lldiv_t res = lldiv(T0, T1);
-        env->LO = (uint64_t)res.quot;
-        env->HI = (uint64_t)res.rem;
+        env->LO = T0 / T1;
+        env->HI = T0 % T1;
     }
 }
 #endif

-- 
  .''`.  Aurelien Jarno             | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   address@hidden         | address@hidden
   `-    people.debian.org/~aurel32 | www.aurel32.net




reply via email to

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