Hi!

Here's the current lot of patches from the SuSE QEMU package. As we have 
now arrived at the point where patches start to conflict with each 
other, I would be very grateful if at least some of these went into the 
next release.

qemu-0.7.0-binfmt.patch: some enhancements to the qemu-binfmt-conf.sh 
script

qemu-0.7.1-armfpaex.patch: proper FPA exception generation for arm-user 
targets

qemu-0.7.1-jobsignals.patch: handle SIGTTOU/SIGTTIN/SIGTSTP; makes job 
control work

qemu-0.7.1-syscalls.patch: implements acct, uselib, syslog, mincore, 
madvise, readahead, clock_gettime; I have not extensively checked these 
for correctness, but from experience I can say that with this patch 
applied a lot of breakage vanishes

qemu-0.8.0-ia64.patch: Itanium host fixes by Andreas Schwab

qemu-nwfpe-cpsr.patch: fixes ARM FPA CPSR updates; same as posted before, 
but fixed to work with qemu-0.7.1-armfpaex.patch

CU
Uli
--- qemu-binfmt-conf.sh
+++ qemu-binfmt-conf.sh
@@ -2,38 +2,46 @@
 # enable automatic i386/ARM/SPARC/PPC program execution by the kernel
 
 # load the binfmt_misc module
-/sbin/modprobe binfmt_misc
+
+if test ! -e /proc/sys/fs/binfmt_misc/register
+then
+	/sbin/modprobe binfmt_misc
+	mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
+fi
 
 # probe cpu type
 cpu=`uname -m`
 case "$cpu" in
-  i386|i486|i586|i686|i86pc|BePC)
+  i386|i486|i586|i686|i86pc|BePC|x86_64)
     cpu="i386"
   ;;
   "Power Macintosh"|ppc|ppc64)
     cpu="ppc"
   ;;
-  armv4l)
+  armv[4-9]*l)
     cpu="arm"
   ;;
+  sparc*)
+    cpu="sparc"
+  ;;
 esac
 
 # register the interpreter for each cpu except for the native one
 if [ $cpu != "i386" ] ; then
-    echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
-    echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
+    echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
+    echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
 fi
 if [ $cpu != "arm" ] ; then
-    echo   ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
-    echo   ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
 fi
 if [ $cpu != "sparc" ] ; then
-    echo   ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
 fi
 if [ $cpu != "ppc" ] ; then
-    echo   ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
 fi
 if [ $cpu != "mips" ] ; then
-    echo   ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips:' > /proc/sys/fs/binfmt_misc/register
-    echo   ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsel:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips:' > /proc/sys/fs/binfmt_misc/register
+    echo   ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel:' > /proc/sys/fs/binfmt_misc/register
 fi
--- linux-user/main.c
+++ linux-user/main.c
@@ -339,18 +339,54 @@
             {
                 TaskState *ts = env->opaque;
                 uint32_t opcode;
+                int rc;
 
                 /* we handle the FPU emulation here, as Linux */
                 /* we get the opcode */
                 opcode = ldl_raw((uint8_t *)env->regs[15]);
                 
-                if (EmulateAll(opcode, &ts->fpa, env->regs) == 0) {
+                if ((rc=EmulateAll(opcode, &ts->fpa, env->regs)) == 0) { /* illegal instruction */
                     info.si_signo = SIGILL;
                     info.si_errno = 0;
                     info.si_code = TARGET_ILL_ILLOPN;
                     info._sifields._sigfault._addr = env->regs[15];
                     queue_signal(info.si_signo, &info);
-                } else {
+                } else if (rc < 0) { /* FP exception */
+                    int arm_fpe=0;
+                    /* translate softfloat flags to FPSR flags */
+                    if(-rc & float_flag_invalid) arm_fpe |= BIT_IOC;
+                    if(-rc & float_flag_divbyzero) arm_fpe |= BIT_DZC;
+                    if(-rc & float_flag_overflow) arm_fpe |= BIT_OFC;
+                    if(-rc & float_flag_underflow) arm_fpe |= BIT_UFC;
+                    if(-rc & float_flag_inexact) arm_fpe |= BIT_IXC;
+
+                    FPSR fpsr = ts->fpa.fpsr;
+                    //printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe);
+
+                    if(fpsr & (arm_fpe << 16))	/* exception enabled? */
+                    {
+                      info.si_signo = SIGFPE;
+                      info.si_errno = 0;
+                      /* ordered by priority, least first */
+                      if(arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
+                      if(arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
+                      if(arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
+                      if(arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
+                      if(arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
+                      info._sifields._sigfault._addr = env->regs[15];
+                      queue_signal(info.si_signo, &info);
+                    }
+                    else
+                      env->regs[15] += 4;
+                    
+                    /* accumulate unenabled exceptions */
+                    if((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC)) fpsr |= BIT_IXC;
+                    if((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC)) fpsr |= BIT_UFC;
+                    if((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC)) fpsr |= BIT_OFC;
+                    if((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC)) fpsr |= BIT_DZC;
+                    if((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC)) fpsr |= BIT_IOC;
+                    ts->fpa.fpsr=fpsr;
+                } else { /* everything OK */
                     /* increment PC */
                     env->regs[15] += 4;
                 }
--- target-arm/nwfpe/fpa11.c
+++ target-arm/nwfpe/fpa11.c
@@ -161,6 +161,8 @@
     fpa11->initflag = 1;
   }
 
+  set_float_exception_flags(0, &fpa11->fp_status);  
+
   if (TEST_OPCODE(opcode,MASK_CPRT))
   {
     //fprintf(stderr,"emulating CPRT\n");
@@ -190,6 +192,11 @@
   }
 
 //  restore_flags(flags);
+  if(nRc == 1 && get_float_exception_flags(&fpa11->fp_status))
+  {
+    //printf("fef 0x%x\n",float_exception_flags);
+    nRc=-get_float_exception_flags(&fpa11->fp_status);
+  }
 
   //printf("returning %d\n",nRc);
   return(nRc);
--- linux-user/signal.c
+++ linux-user/signal.c
@@ -341,10 +341,15 @@
     k = &sigact_table[sig - 1];
     handler = k->sa._sa_handler;
     if (handler == TARGET_SIG_DFL) {
+        if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) {
+            kill(getpid(),SIGSTOP);
+            return 0;
+        } else
         /* default handler : ignore some signal. The other are fatal */
         if (sig != TARGET_SIGCHLD && 
             sig != TARGET_SIGURG && 
-            sig != TARGET_SIGWINCH) {
+            sig != TARGET_SIGWINCH &&
+            sig != TARGET_SIGCONT) {
             force_sig(sig);
         } else {
             return 0; /* indicate ignored */
--- linux-user/arm/syscall_nr.h
+++ linux-user/arm/syscall_nr.h
@@ -259,4 +259,5 @@
 					/* 254 for set_thread_area */
 					/* 255 for get_thread_area */
 					/* 256 for set_tid_address */
+#define TARGET_NR_clock_gettime			(263)
 #define TARGET_NR_utimes		        (269)
--- linux-user/syscall.c
+++ linux-user/syscall.c
@@ -207,6 +207,7 @@
 #define __NR_sys_getdents __NR_getdents
 #define __NR_sys_getdents64 __NR_getdents64
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
+#define __NR_sys_syslog __NR_syslog
 
 #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
 #define __NR__llseek __NR_lseek
@@ -228,6 +229,7 @@
 _syscall2(int,sys_statfs,const char *,path,struct kernel_statfs *,buf)
 _syscall2(int,sys_fstatfs,int,fd,struct kernel_statfs *,buf)
 _syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo)
+_syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
 #ifdef __NR_exit_group
 _syscall1(int,exit_group,int,error_code)
 #endif
@@ -241,6 +243,7 @@
 extern int setresgid(gid_t, gid_t, gid_t);
 extern int getresgid(gid_t *, gid_t *, gid_t *);
 extern int setgroups(int, gid_t *);
+extern int uselib(const char*);
 
 static inline long get_errno(long ret)
 {
@@ -1895,7 +1898,9 @@
         goto unimplemented;
 
     case TARGET_NR_acct:
-        goto unimplemented;
+        ret = get_errno(acct(path((const char*)arg1)));
+        break;
+
     case TARGET_NR_umount2:
         ret = get_errno(umount2((const char *)arg1, arg2));
         break;
@@ -2207,7 +2212,9 @@
         ret = get_errno(readlink(path((const char *)arg1), (char *)arg2, arg3));
         break;
     case TARGET_NR_uselib:
-        goto unimplemented;
+        ret = get_errno(uselib(path((const char*)arg1)));
+        break;
+
     case TARGET_NR_swapon:
         ret = get_errno(swapon((const char *)arg1, arg2));
         break;
@@ -2322,7 +2329,9 @@
         ret = do_socketcall(arg1, (int32_t *)arg2);
         break;
     case TARGET_NR_syslog:
-        goto unimplemented;
+        ret = get_errno(sys_syslog((int)arg1, (char*)arg2, (int)arg3));
+        break;
+
     case TARGET_NR_setitimer:
         {
             struct target_itimerval *target_value = (void *)arg2;
@@ -3116,11 +3125,14 @@
         goto unimplemented;
 #ifdef TARGET_NR_mincore
     case TARGET_NR_mincore:
-        goto unimplemented;
+        page_unprotect_range((void*)arg3, ((size_t)arg2 + TARGET_PAGE_SIZE - 1) / TARGET_PAGE_SIZE);
+        ret = get_errno(mincore((void*)arg1, (size_t)arg2, (unsigned char*)arg3));
+        break;
 #endif
 #ifdef TARGET_NR_madvise
     case TARGET_NR_madvise:
-        goto unimplemented;
+        ret = get_errno(madvise((void*)arg1, (size_t)arg2, (int)arg3));
+        break;
 #endif
 #if TARGET_LONG_BITS == 32
     case TARGET_NR_fcntl64:
@@ -3169,7 +3181,8 @@
         ret = get_errno(gettid());
         break;
     case TARGET_NR_readahead:
-        goto unimplemented;
+        ret = get_errno(readahead((int)arg1, (off64_t)arg2, (size_t)arg3));
+        break;
 #ifdef TARGET_NR_setxattr
     case TARGET_NR_setxattr:
     case TARGET_NR_lsetxattr:
@@ -3190,6 +3203,22 @@
     case TARGET_NR_get_thread_area:
         goto unimplemented_nowarn;
 #endif
+#ifdef TARGET_NR_clock_gettime
+    case TARGET_NR_clock_gettime:
+    {
+        struct target_timespec* ttp = (struct target_timespec*)arg2;
+        struct timespec htp;
+        if(ttp) {
+          htp.tv_sec = tswapl(ttp->tv_sec);
+          htp.tv_nsec = tswapl(ttp->tv_nsec);
+          ret = get_errno(clock_gettime((clockid_t)arg1, &htp));
+          ttp->tv_sec = tswapl(htp.tv_sec);
+          ttp->tv_nsec = tswapl(htp.tv_nsec);
+        } else
+          ret = get_errno(clock_gettime((clockid_t)arg1, NULL));
+        break;
+    }
+#endif
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
---
 Makefile.target      |    3 ---
 cpu-exec.c           |    3 +--
 dyngen.c             |    6 ++++--
 dyngen.h             |    3 +++
 linux-user/syscall.c |    2 +-
 target-mips/exec.h   |    4 ++++
 6 files changed, 13 insertions(+), 8 deletions(-)

Index: Makefile.target
===================================================================
--- Makefile.target.orig	2006-03-07 02:12:48.000000000 +0100
+++ Makefile.target	2006-03-07 02:12:48.000000000 +0100
@@ -252,9 +252,6 @@ ifeq ($(findstring m68k, $(TARGET_ARCH) 
 LIBOBJS+=m68k-dis.o
 endif
 
-ifeq ($(ARCH),ia64)
-OBJS += ia64-syscall.o
-endif
 ifdef CONFIG_GDBSTUB
 OBJS+=gdbstub.o
 endif
Index: cpu-exec.c
===================================================================
--- cpu-exec.c.orig	2005-12-19 23:51:53.000000000 +0100
+++ cpu-exec.c	2006-03-07 02:12:48.000000000 +0100
@@ -1351,7 +1351,6 @@ int cpu_signal_handler(int host_signum, 
 #ifndef __ISR_VALID
   /* This ought to be in <bits/siginfo.h>... */
 # define __ISR_VALID	1
-# define si_flags	_sifields._sigfault._si_pad0
 #endif
 
 int cpu_signal_handler(int host_signum, struct siginfo *info, void *puc)
@@ -1367,7 +1366,7 @@ int cpu_signal_handler(int host_signum, 
       case SIGSEGV:
       case SIGBUS:
       case SIGTRAP:
-	  if (info->si_code && (info->si_flags & __ISR_VALID))
+	  if (info->si_code && (info->si_segvflags & __ISR_VALID))
 	      /* ISR.W (write-access) is bit 33:  */
 	      is_write = (info->si_isr >> 33) & 1;
 	  break;
Index: dyngen.c
===================================================================
--- dyngen.c.orig	2005-12-19 23:51:53.000000000 +0100
+++ dyngen.c	2006-03-07 02:14:36.000000000 +0100
@@ -2469,10 +2469,12 @@ fprintf(outfile,
 );
 #ifdef HOST_IA64
     fprintf(outfile,
-	    "    ia64_apply_fixes(&gen_code_ptr, ltoff_fixes, "
+	    "    {\n"
+	    "      extern char code_gen_buffer[];\n"
+	    "      ia64_apply_fixes(&gen_code_ptr, ltoff_fixes, "
 	    "(uint64_t) code_gen_buffer + 2*(1<<20), plt_fixes,\n\t\t\t"
 	    "sizeof(plt_target)/sizeof(plt_target[0]),\n\t\t\t"
-	    "plt_target, plt_offset);\n");
+	    "plt_target, plt_offset);\n    }\n");
 #endif
 
 /* generate some code patching */ 
Index: dyngen.h
===================================================================
--- dyngen.h.orig	2005-12-19 23:51:53.000000000 +0100
+++ dyngen.h	2006-03-07 02:12:48.000000000 +0100
@@ -420,6 +420,9 @@ static inline void ia64_apply_fixes (uin
 	}
 	ia64_imm22(fixup->addr, (long) vp - gp);
     }
+    /* Keep code ptr aligned. */
+    if ((long) gen_code_ptr & 15)
+	gen_code_ptr += 8;
     *gen_code_pp = gen_code_ptr;
 }
 
Index: linux-user/syscall.c
===================================================================
--- linux-user/syscall.c.orig	2006-03-07 02:12:48.000000000 +0100
+++ linux-user/syscall.c	2006-03-07 02:12:48.000000000 +0100
@@ -1513,7 +1513,7 @@ int do_fork(CPUState *env, unsigned int 
 #endif
         new_env->opaque = ts;
 #ifdef __ia64__
-        ret = clone2(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env);
+        ret = __clone2(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env);
 #else
 	ret = clone(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env);
 #endif
Index: target-mips/exec.h
===================================================================
--- target-mips/exec.h.orig	2005-12-19 23:51:53.000000000 +0100
+++ target-mips/exec.h	2006-03-07 02:12:48.000000000 +0100
@@ -31,7 +31,11 @@ register double FT2 asm(FREG2);
 #endif
 
 #if defined (DEBUG_OP)
+#if defined (__ia64__)
+#define RETURN() __asm__ __volatile__("nop 0");
+#else
 #define RETURN() __asm__ __volatile__("nop");
+#endif
 #else
 #define RETURN() __asm__ __volatile__("");
 #endif
--- qemu-0.8.0/linux-user/main.c
+++ qemu-0.8.0/linux-user/main.c
@@ -346,7 +346,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;
--- qemu-0.8.0/target-arm/nwfpe/fpa11.c
+++ qemu-0.8.0/target-arm/nwfpe/fpa11.c
@@ -36,7 +36,7 @@
 unsigned int EmulateCPRT(const unsigned int);
 
 FPA11* qemufpa=0;
-unsigned int* user_registers=0;
+CPUARMState* user_registers=0;
 
 /* Reset the FPA11 chip.  Called to initialize and reset the emulator. */
 void resetFPA11(void)
@@ -137,7 +137,7 @@
 }
 
 /* Emulate the instruction in the opcode. */
-unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, unsigned int* qregs)
+unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)
 {
   unsigned int nRc = 0;
 //  unsigned long flags;
--- qemu-0.8.0/target-arm/nwfpe/fpa11.h
+++ qemu-0.8.0/target-arm/nwfpe/fpa11.h
@@ -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_M);
 }
 
 #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"
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to