Package: qemu
Version: 0.8.0-2
Severity: important
Tags: patch

New patch, now backported from QEMU CVS (and slightly modified to not
conflict with 40_fpu_arm_sigfpe.patch).

--
Anderson Lizardo
Embedded Linux Lab - 10LE
Nokia Institute of Technology - INdT
Manaus - Brazil
Changelog:

  * Fix bug in the glue code between NWFPE and QEMU.
    - debian/patches/41_nwfpe_cpsr.patch: New file.
    Thanks to Ulrich Hecht.

Index: qemu-0.8.0/debian/patches/41_nwfpe_cpsr.patch
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ qemu-0.8.0/debian/patches/41_nwfpe_cpsr.patch	2006-03-11 21:48:49.000000000 -0400
@@ -0,0 +1,118 @@
+#DPATCHLEVEL=0
+Index: linux-user/main.c
+===================================================================
+RCS file: /sources/qemu/qemu/linux-user/main.c,v
+retrieving revision 1.79
+retrieving revision 1.80
+diff -u -r1.79 -r1.80
+--- linux-user/main.c	20 Feb 2006 00:33:36 -0000	1.79
++++ linux-user/main.c	11 Mar 2006 21:03:16 -0000	1.80
+@@ -345,7 +345,7 @@
+                 /* we get the opcode */
+                 opcode = ldl_raw((uint8_t *)env->regs[15]);
+                 
+-                if ((rc=EmulateAll(opcode, &ts->fpa, env->regs)) == 0) { /* illegal instruction */
++                if ((rc=EmulateAll(opcode, &ts->fpa, env)) == 0) { /* illegal instruction */
+                     info.si_signo = SIGILL;
+                     info.si_errno = 0;
+                     info.si_code = TARGET_ILL_ILLOPN;
+Index: target-arm/nwfpe/fpa11.c
+===================================================================
+RCS file: /sources/qemu/qemu/target-arm/nwfpe/fpa11.c,v
+retrieving revision 1.2
+retrieving revision 1.3
+diff -u -r1.2 -r1.3
+--- target-arm/nwfpe/fpa11.c	13 Mar 2005 16:55:58 -0000	1.2
++++ target-arm/nwfpe/fpa11.c	11 Mar 2006 21:03:16 -0000	1.3
+@@ -36,7 +36,7 @@
+ unsigned int EmulateCPRT(const unsigned int);
+ 
+ FPA11* qemufpa=0;
+-unsigned int* user_registers=0;
++CPUARMState* user_registers;
+ 
+ /* Reset the FPA11 chip.  Called to initialize and reset the emulator. */
+ void resetFPA11(void)
+@@ -137,7 +137,8 @@
+ }
+ 
+ /* Emulate the instruction in the opcode. */
+-unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, unsigned int* qregs)
++/* ??? This is not thread safe.  */
++unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)
+ {
+   unsigned int nRc = 0;
+ //  unsigned long flags;
+Index: target-arm/nwfpe/fpa11.h
+===================================================================
+RCS file: /sources/qemu/qemu/target-arm/nwfpe/fpa11.h,v
+retrieving revision 1.3
+retrieving revision 1.4
+diff -u -r1.3 -r1.4
+--- target-arm/nwfpe/fpa11.h	13 Mar 2005 16:55:58 -0000	1.3
++++ target-arm/nwfpe/fpa11.h	11 Mar 2006 21:03:16 -0000	1.4
+@@ -26,6 +26,8 @@
+ #include <stdio.h>
+ #include <errno.h>
+ 
++#include <cpu.h>
++
+ #define GET_FPA11() (qemufpa)
+ 
+ /*
+@@ -33,7 +35,7 @@
+  * stack+task struct.  Use the same method as 'current' uses to
+  * reach them.
+  */
+-extern unsigned int *user_registers;
++extern CPUARMState *user_registers;
+ 
+ #define GET_USERREG() (user_registers)
+ 
+@@ -94,7 +96,7 @@
+ 
+ static inline unsigned int readRegister(unsigned int reg)
+ {
+-    return (user_registers[(reg)]);
++    return (user_registers->regs[(reg)]);
+ }
+ 
+ static inline void writeRegister(unsigned int x, unsigned int y)
+@@ -102,34 +104,17 @@
+ #if 0
+ 	printf("writing %d to r%d\n",y,x);
+ #endif
+-        user_registers[(x)]=(y);
++        user_registers->regs[(x)]=(y);
+ }
+ 
+ static inline void writeConditionCodes(unsigned int x)
+ {
+-#if 0
+-unsigned	int y;
+-unsigned    int ZF;
+-	printf("setting flags to %x from %x\n",x,user_registers[16]);
+-#endif
+-	user_registers[16]=(x);	// cpsr
+-	user_registers[17]=(x>>29)&1;	// cf
+-	user_registers[18]=(x<<3)&(1<<31);	// vf
+-	user_registers[19]=x&(1<<31);	// nzf
+-	if(!(x&(1<<30))) user_registers[19]++;	// nzf must be non-zero for zf to be cleared
+-
+-#if 0
+-        ZF = (user_registers[19] == 0);
+-        y=user_registers[16] | (user_registers[19] & 0x80000000) | (ZF << 30) | 
+-                    (user_registers[17] << 29) | ((user_registers[18] & 0x80000000) >> 3);
+-        if(y != x)
+-        	printf("GODDAM SHIIIIIIIIIIIIIIIIT! %x %x nzf %x zf %x\n",x,y,user_registers[19],ZF);
+-#endif                    
++        cpsr_write(user_registers,x,CPSR_NZCV);
+ }
+ 
+ #define REG_PC 15
+ 
+-unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, unsigned int* qregs);
++unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs);
+ 
+ /* included only for get_user/put_user macros */
+ #include "qemu.h"

Reply via email to