r2403 - in trunk/src/host/qemu-neo1973: . audio hw linux-user target-arm target-i386 target-mips target-ppc target-sparc

andrew at sita.openmoko.org andrew at sita.openmoko.org
Thu Jul 26 22:50:36 CEST 2007


Author: andrew
Date: 2007-07-26 22:50:21 +0200 (Thu, 26 Jul 2007)
New Revision: 2403

Modified:
   trunk/src/host/qemu-neo1973/Makefile.target
   trunk/src/host/qemu-neo1973/audio/alsaaudio.c
   trunk/src/host/qemu-neo1973/audio/audio.c
   trunk/src/host/qemu-neo1973/audio/audio_int.h
   trunk/src/host/qemu-neo1973/audio/sdlaudio.c
   trunk/src/host/qemu-neo1973/block-raw.c
   trunk/src/host/qemu-neo1973/block-vmdk.c
   trunk/src/host/qemu-neo1973/configure
   trunk/src/host/qemu-neo1973/console.c
   trunk/src/host/qemu-neo1973/dis-asm.h
   trunk/src/host/qemu-neo1973/dyngen.c
   trunk/src/host/qemu-neo1973/gdbstub.c
   trunk/src/host/qemu-neo1973/hw/fdc.c
   trunk/src/host/qemu-neo1973/hw/gt64xxx.c
   trunk/src/host/qemu-neo1973/hw/i2c.h
   trunk/src/host/qemu-neo1973/hw/ide.c
   trunk/src/host/qemu-neo1973/hw/iommu.c
   trunk/src/host/qemu-neo1973/hw/mips_malta.c
   trunk/src/host/qemu-neo1973/hw/pl011.c
   trunk/src/host/qemu-neo1973/hw/pl181.c
   trunk/src/host/qemu-neo1973/hw/pxa2xx.c
   trunk/src/host/qemu-neo1973/hw/rtl8139.c
   trunk/src/host/qemu-neo1973/hw/sun4u.c
   trunk/src/host/qemu-neo1973/hw/tcx.c
   trunk/src/host/qemu-neo1973/hw/usb-ohci.c
   trunk/src/host/qemu-neo1973/hw/usb.c
   trunk/src/host/qemu-neo1973/linux-user/elfload.c
   trunk/src/host/qemu-neo1973/linux-user/main.c
   trunk/src/host/qemu-neo1973/linux-user/signal.c
   trunk/src/host/qemu-neo1973/linux-user/syscall.c
   trunk/src/host/qemu-neo1973/linux-user/syscall_defs.h
   trunk/src/host/qemu-neo1973/m68k-dis.c
   trunk/src/host/qemu-neo1973/qemu-doc.texi
   trunk/src/host/qemu-neo1973/qemu-tech.texi
   trunk/src/host/qemu-neo1973/target-arm/op.c
   trunk/src/host/qemu-neo1973/target-i386/cpu.h
   trunk/src/host/qemu-neo1973/target-mips/TODO
   trunk/src/host/qemu-neo1973/target-ppc/cpu.h
   trunk/src/host/qemu-neo1973/target-ppc/exec.h
   trunk/src/host/qemu-neo1973/target-ppc/helper.c
   trunk/src/host/qemu-neo1973/target-ppc/translate_init.c
   trunk/src/host/qemu-neo1973/target-sparc/cpu.h
   trunk/src/host/qemu-neo1973/target-sparc/op.c
   trunk/src/host/qemu-neo1973/target-sparc/op_helper.c
   trunk/src/host/qemu-neo1973/target-sparc/op_mem.h
   trunk/src/host/qemu-neo1973/target-sparc/translate.c
   trunk/src/host/qemu-neo1973/vl.c
   trunk/src/host/qemu-neo1973/vl.h
Log:
Pull changes from cvs.savannah.nongnu.org:/sources/qemu. (Closing bug #659)


Modified: trunk/src/host/qemu-neo1973/Makefile.target
===================================================================
--- trunk/src/host/qemu-neo1973/Makefile.target	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/Makefile.target	2007-07-26 20:50:21 UTC (rev 2403)
@@ -505,7 +505,7 @@
 VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
 endif
 
-VL_LDFLAGS=
+VL_LDFLAGS=$(VL_OS_LDFLAGS)
 VL_LIBS=$(AIOLIBS)
 # specific flags are needed for non soft mmu emulator
 ifdef CONFIG_STATIC

Modified: trunk/src/host/qemu-neo1973/audio/alsaaudio.c
===================================================================
--- trunk/src/host/qemu-neo1973/audio/alsaaudio.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/audio/alsaaudio.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -50,11 +50,11 @@
     unsigned int period_size_out;
     unsigned int threshold;
 
-    int buffer_size_in_overriden;
-    int period_size_in_overriden;
+    int buffer_size_in_overridden;
+    int period_size_in_overridden;
 
-    int buffer_size_out_overriden;
-    int period_size_out_overriden;
+    int buffer_size_out_overridden;
+    int period_size_out_overridden;
     int verbose;
 } conf = {
 #define DEFAULT_BUFFER_SIZE 1024
@@ -75,10 +75,10 @@
     .period_size_in = DEFAULT_PERIOD_SIZE * 4,
     .buffer_size_out = DEFAULT_BUFFER_SIZE,
     .period_size_out = DEFAULT_PERIOD_SIZE,
-    .buffer_size_in_overriden = 0,
-    .buffer_size_out_overriden = 0,
-    .period_size_in_overriden = 0,
-    .period_size_out_overriden = 0,
+    .buffer_size_in_overridden = 0,
+    .buffer_size_out_overridden = 0,
+    .period_size_in_overridden = 0,
+    .period_size_out_overridden = 0,
 #endif
     .threshold = 0,
     .verbose = 0
@@ -414,8 +414,8 @@
                 }
                 else {
                     if (period_size < minval) {
-                        if ((in && conf.period_size_in_overriden)
-                            || (!in && conf.period_size_out_overriden)) {
+                        if ((in && conf.period_size_in_overridden)
+                            || (!in && conf.period_size_out_overridden)) {
                             dolog ("%s period size(%d) is less "
                                    "than minmal period size(%ld)\n",
                                    typ,
@@ -450,8 +450,8 @@
             }
             else {
                 if (buffer_size < minval) {
-                    if ((in && conf.buffer_size_in_overriden)
-                        || (!in && conf.buffer_size_out_overriden)) {
+                    if ((in && conf.buffer_size_in_overridden)
+                        || (!in && conf.buffer_size_out_overridden)) {
                         dolog (
                             "%s buffer size(%d) is less "
                             "than minimal buffer size(%ld)\n",
@@ -945,16 +945,16 @@
     {"DAC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_out,
      "DAC period/buffer size in microseconds (otherwise in frames)", NULL, 0},
     {"DAC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_out,
-     "DAC period size", &conf.period_size_out_overriden, 0},
+     "DAC period size", &conf.period_size_out_overridden, 0},
     {"DAC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_out,
-     "DAC buffer size", &conf.buffer_size_out_overriden, 0},
+     "DAC buffer size", &conf.buffer_size_out_overridden, 0},
 
     {"ADC_SIZE_IN_USEC", AUD_OPT_BOOL, &conf.size_in_usec_in,
      "ADC period/buffer size in microseconds (otherwise in frames)", NULL, 0},
     {"ADC_PERIOD_SIZE", AUD_OPT_INT, &conf.period_size_in,
-     "ADC period size", &conf.period_size_in_overriden, 0},
+     "ADC period size", &conf.period_size_in_overridden, 0},
     {"ADC_BUFFER_SIZE", AUD_OPT_INT, &conf.buffer_size_in,
-     "ADC buffer size", &conf.buffer_size_in_overriden, 0},
+     "ADC buffer size", &conf.buffer_size_in_overridden, 0},
 
     {"THRESHOLD", AUD_OPT_INT, &conf.threshold,
      "(undocumented)", NULL, 0},

Modified: trunk/src/host/qemu-neo1973/audio/audio.c
===================================================================
--- trunk/src/host/qemu-neo1973/audio/audio.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/audio/audio.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -386,7 +386,7 @@
         const char *state = "default";
         printf ("  %s_%s: ", uprefix, opt->name);
 
-        if (opt->overridenp && *opt->overridenp) {
+        if (opt->overriddenp && *opt->overriddenp) {
             state = "current";
         }
 
@@ -516,10 +516,10 @@
             break;
         }
 
-        if (!opt->overridenp) {
-            opt->overridenp = &opt->overriden;
+        if (!opt->overriddenp) {
+            opt->overriddenp = &opt->overridden;
         }
-        *opt->overridenp = !def;
+        *opt->overriddenp = !def;
         qemu_free (optname);
     }
 }

Modified: trunk/src/host/qemu-neo1973/audio/audio_int.h
===================================================================
--- trunk/src/host/qemu-neo1973/audio/audio_int.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/audio/audio_int.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -44,8 +44,8 @@
     audio_option_tag_e tag;
     void *valp;
     const char *descr;
-    int *overridenp;
-    int overriden;
+    int *overriddenp;
+    int overridden;
 };
 
 struct audio_callback {

Modified: trunk/src/host/qemu-neo1973/audio/sdlaudio.c
===================================================================
--- trunk/src/host/qemu-neo1973/audio/sdlaudio.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/audio/sdlaudio.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -25,6 +25,13 @@
 #include <SDL_thread.h>
 #include "vl.h"
 
+#ifndef _WIN32
+#ifdef __sun__
+#define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+#include <signal.h>
+#endif
+
 #define AUDIO_CAP "sdl"
 #include "audio_int.h"
 
@@ -177,11 +184,22 @@
 static int sdl_open (SDL_AudioSpec *req, SDL_AudioSpec *obt)
 {
     int status;
+#ifndef _WIN32
+    sigset_t new, old;
 
+    /* Make sure potential threads created by SDL don't hog signals.  */
+    sigfillset (&new);
+    pthread_sigmask (SIG_BLOCK, &new, &old);
+#endif
+
     status = SDL_OpenAudio (req, obt);
     if (status) {
         sdl_logerr ("SDL_OpenAudio failed\n");
     }
+
+#ifndef _WIN32
+    pthread_sigmask (SIG_SETMASK, &old, 0);
+#endif
     return status;
 }
 

Modified: trunk/src/host/qemu-neo1973/block-raw.c
===================================================================
--- trunk/src/host/qemu-neo1973/block-raw.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/block-raw.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -1295,7 +1295,7 @@
 
 #if 0
 /***********************************************/
-/* removable device additionnal commands */
+/* removable device additional commands */
 
 static int raw_is_inserted(BlockDriverState *bs)
 {

Modified: trunk/src/host/qemu-neo1973/block-vmdk.c
===================================================================
--- trunk/src/host/qemu-neo1973/block-vmdk.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/block-vmdk.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -572,7 +572,7 @@
         if (!s->is_parent) {
             status = stat(s->hd->filename, &file_buf);
             if (status == -1) {
-                fprintf(stderr, "(VMDK) Fail file stat: filename =%s size=0x%lx errno=%s\n",
+                fprintf(stderr, "(VMDK) Fail file stat: filename =%s size=0x%llx errno=%s\n",
                                 s->hd->filename, (uint64_t)file_buf.st_size, strerror(errno));
                 return 0;
             }
@@ -668,7 +668,7 @@
 
     if (sector_num > bs->total_sectors) {
         fprintf(stderr,
-                "(VMDK) Wrong offset: sector_num=0x%lx total_sectors=0x%lx\n",
+                "(VMDK) Wrong offset: sector_num=0x%llx total_sectors=0x%llx\n",
                 sector_num, bs->total_sectors);
         return -1;
     }

Modified: trunk/src/host/qemu-neo1973/configure
===================================================================
--- trunk/src/host/qemu-neo1973/configure	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/configure	2007-07-26 20:50:21 UTC (rev 2403)
@@ -23,7 +23,7 @@
 cross_prefix=""
 cc="gcc"
 gcc3_search="yes"
-gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
+gcc3_list="gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
 host_cc="gcc"
 ar="ar"
 make="make"
@@ -109,9 +109,16 @@
 CYGWIN*)
 mingw32="yes"
 OS_CFLAGS="-mno-cygwin"
+VL_OS_LDFLAGS="-mno-cygwin"
+if [ "$cpu" = "i386" ] ; then
+    kqemu="yes"
+fi
 ;;
 MINGW32*)
 mingw32="yes"
+if [ "$cpu" = "i386" ] ; then
+    kqemu="yes"
+fi
 ;;
 GNU/kFreeBSD)
 oss="yes"
@@ -391,9 +398,6 @@
     linux="no"
     EXESUF=".exe"
     oss="no"
-    if [ "$cpu" = "i386" ] ; then
-        kqemu="yes"
-    fi
 fi
 
 # Check for gcc4, error if pre-gcc4 
@@ -410,7 +414,7 @@
 	if test "$gcc3_search" = "yes" ; then
 	    echo "Looking for gcc 3.x"
 	    for compat_cc in $gcc3_list ; do
-		if "$cross_prefix$compat_cc" --version > /dev/null 2>&1 ; then
+		if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
 		    echo "Found \"$compat_cc\""
 		    cc="$cross_prefix$compat_cc"
 		    found_compat_cc="yes"
@@ -537,58 +541,52 @@
 sdl_too_old=no
 
 if test -z "$sdl" ; then
+    sdl_config="sdl-config"
+    sdl=no
+    sdl_static=no
 
-sdl_config="sdl-config"
-sdl=no
-sdl_static=no
-
-if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
-# win32 cross compilation case
-    sdl_config="i386-mingw32msvc-sdl-config"
-    sdl=yes
-else
-# normal SDL probe
+    if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
+    # win32 cross compilation case
+        sdl_config="i386-mingw32msvc-sdl-config"
+        sdl=yes
+    else
+        # normal SDL probe
 cat > $TMPC << EOF
 #include <SDL.h>
 #undef main /* We don't want SDL to override our main() */
 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
 EOF
+        if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
+            _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
+            if test "$_sdlversion" -lt 121 ; then
+                sdl_too_old=yes
+            else
+                if test "$cocoa" = "no" ; then
+                    sdl=yes
+                fi
+            fi
 
-if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
-_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
-if test "$_sdlversion" -lt 121 ; then
-sdl_too_old=yes
-else
- if test "$cocoa" = "no" ; then
-   sdl=yes
- fi
-fi
+            # static link with sdl ?
+            if test "$sdl" = "yes" ; then
+                aa="no"
+                `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
+                sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
+                if [ "$aa" = "yes" ] ; then
+                    sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
+                fi
 
-# static link with sdl ?
-if test "$sdl" = "yes" ; then
-aa="no"
-`$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
-sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
-if [ "$aa" = "yes" ] ; then
-  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
-fi
-
-if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
-  sdl_static=yes
-fi
-
-fi # static link
-
-fi # sdl compile test
-
-fi # cross compilation
-
+                if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
+                    sdl_static=yes
+                fi
+            fi # static link
+        fi # sdl compile test
+    fi # cross compilation
 else
- # Make sure to disable cocoa if sdl was set
- if test "$sdl" = "yes" ; then
-   cocoa="no"
-   coreaudio="no"
- fi
+    # Make sure to disable cocoa if sdl was set
+    if test "$sdl" = "yes" ; then
+       cocoa="no"
+       coreaudio="no"
+    fi
 fi # -z $sdl
 
 ##########################################
@@ -729,6 +727,11 @@
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
 fi
+if [ -s /tmp/qemu-$$-sdl-config.log ]; then
+  echo "The error log from compiling the libSDL test is: "
+  cat /tmp/qemu-$$-sdl-config.log
+fi
+rm -f /tmp/qemu-$$-sdl-config.log
 #if test "$sdl_static" = "no"; then
 #  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
 #fi
@@ -755,6 +758,7 @@
 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
+echo "VL_OS_LDFLAGS=$VL_OS_LDFLAGS" >> $config_mak
 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
 echo "CFLAGS=$CFLAGS" >> $config_mak

Modified: trunk/src/host/qemu-neo1973/console.c
===================================================================
--- trunk/src/host/qemu-neo1973/console.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/console.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -104,10 +104,16 @@
     return len1;
 }
 
+typedef enum {
+    GRAPHIC_CONSOLE,
+    TEXT_CONSOLE,
+    TEXT_CONSOLE_FIXED_SIZE
+} console_type_t;
+
 /* ??? This is mis-named.
    It is used for both text and graphical consoles.  */
 struct TextConsole {
-    int text_console; /* true if text console */
+    console_type_t console_type;
     DisplayState *ds;
     /* Graphic console state.  */
     vga_hw_update_ptr hw_update;
@@ -587,7 +593,7 @@
     int i, y1;
     
     s = active_console;
-    if (!s || !s->text_console)
+    if (!s || (s->console_type == GRAPHIC_CONSOLE))
         return;
 
     if (ydelta > 0) {
@@ -990,13 +996,17 @@
     s = consoles[index];
     if (s) {
         active_console = s;
-        if (s->text_console) {
+        if (s->console_type != GRAPHIC_CONSOLE) {
             if (s->g_width != s->ds->width ||
                 s->g_height != s->ds->height) {
+                if (s->console_type == TEXT_CONSOLE_FIXED_SIZE) {
+                    dpy_resize(s->ds, s->g_width, s->g_height);
+                } else {
                 s->g_width = s->ds->width;
                 s->g_height = s->ds->height;
                 text_console_resize(s);
             }
+            }
             console_refresh(s);
         } else {
             vga_hw_invalidate();
@@ -1062,7 +1072,7 @@
     int c;
 
     s = active_console;
-    if (!s || !s->text_console)
+    if (!s || (s->console_type == GRAPHIC_CONSOLE))
         return;
 
     switch(keysym) {
@@ -1104,7 +1114,7 @@
     }
 }
 
-static TextConsole *new_console(DisplayState *ds, int text)
+static TextConsole *new_console(DisplayState *ds, console_type_t console_type)
 {
     TextConsole *s;
     int i;
@@ -1115,16 +1125,18 @@
     if (!s) {
         return NULL;
     }
-    if (!active_console || (active_console->text_console && !text))
+    if (!active_console || ((active_console->console_type != GRAPHIC_CONSOLE) &&
+        (console_type == GRAPHIC_CONSOLE))) {
         active_console = s;
+    }
     s->ds = ds;
-    s->text_console = text;
-    if (text) {
+    s->console_type = console_type;
+    if (console_type != GRAPHIC_CONSOLE) {
         consoles[nb_consoles++] = s;
     } else {
         /* HACK: Put graphical consoles before text consoles.  */
         for (i = nb_consoles; i > 0; i--) {
-            if (!consoles[i - 1]->text_console)
+            if (consoles[i - 1]->console_type == GRAPHIC_CONSOLE)
                 break;
             consoles[i] = consoles[i - 1];
         }
@@ -1140,7 +1152,7 @@
 {
     TextConsole *s;
 
-    s = new_console(ds, 0);
+    s = new_console(ds, GRAPHIC_CONSOLE);
     if (!s)
       return NULL;
     s->hw_update = update;
@@ -1152,20 +1164,22 @@
 
 int is_graphic_console(void)
 {
-    return !active_console->text_console;
+    return active_console->console_type == GRAPHIC_CONSOLE;
 }
 
-CharDriverState *text_console_init(DisplayState *ds)
+CharDriverState *text_console_init(DisplayState *ds, const char *p)
 {
     CharDriverState *chr;
     TextConsole *s;
     int i,j;
+    unsigned width;
+    unsigned height;
     static int color_inited;
 
     chr = qemu_mallocz(sizeof(CharDriverState));
     if (!chr)
         return NULL;
-    s = new_console(ds, 1);
+    s = new_console(ds, (p == 0) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE);
     if (!s) {
         free(chr);
         return NULL;
@@ -1193,8 +1207,25 @@
     s->total_height = DEFAULT_BACKSCROLL;
     s->x = 0;
     s->y = 0;
-    s->g_width = s->ds->width;
-    s->g_height = s->ds->height;
+    width = s->ds->width;
+    height = s->ds->height;
+    if (p != 0) {
+        width = strtoul(p, (char **)&p, 10);
+        if (*p == 'C') {
+            p++;
+            width *= FONT_WIDTH;
+        }
+        if (*p == 'x') {
+            p++;
+            height = strtoul(p, (char **)&p, 10);
+            if (*p == 'C') {
+                p++;
+                height *= FONT_HEIGHT;
+            }
+        }
+    }
+    s->g_width = width;
+    s->g_height = height;
 
     /* Set text attribute defaults */
     s->t_attrib_default.bold = 0;

Modified: trunk/src/host/qemu-neo1973/dis-asm.h
===================================================================
--- trunk/src/host/qemu-neo1973/dis-asm.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/dis-asm.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -421,7 +421,7 @@
 /* Call this macro to initialize only the internal variables for the
    disassembler.  Architecture dependent things such as byte order, or machine
    variant are not touched by this macro.  This makes things much easier for
-   GDB which must initialize these things seperatly.  */
+   GDB which must initialize these things separately.  */
 
 #define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \
   (INFO).fprintf_func = (FPRINTF_FUNC), \

Modified: trunk/src/host/qemu-neo1973/dyngen.c
===================================================================
--- trunk/src/host/qemu-neo1973/dyngen.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/dyngen.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -1845,7 +1845,7 @@
         /* patch relocations */
 #if defined(HOST_I386)
             {
-                char name[256];
+                char relname[256];
                 int type;
                 int addend;
                 int reloc_offset;
@@ -1868,18 +1868,18 @@
                         continue;
                     }
 
-                    get_reloc_expr(name, sizeof(name), sym_name);
+                    get_reloc_expr(relname, sizeof(relname), sym_name);
                     addend = get32((uint32_t *)(text + rel->r_offset));
 #ifdef CONFIG_FORMAT_ELF
                     type = ELF32_R_TYPE(rel->r_info);
                     switch(type) {
                     case R_386_32:
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
-                                reloc_offset, name, addend);
+                                reloc_offset, relname, addend);
                         break;
                     case R_386_PC32:
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) + %d;\n", 
-                                reloc_offset, name, reloc_offset, addend);
+                                reloc_offset, relname, reloc_offset, addend);
                         break;
                     default:
                         error("unsupported i386 relocation (%d)", type);
@@ -1902,11 +1902,11 @@
                     switch(type) {
                     case DIR32:
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
-                                reloc_offset, name, addend);
+                                reloc_offset, relname, addend);
                         break;
                     case DISP32:
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) + %d -4;\n", 
-                                reloc_offset, name, reloc_offset, addend);
+                                reloc_offset, relname, reloc_offset, addend);
                         break;
                     default:
                         error("unsupported i386 relocation (%d)", type);
@@ -1919,7 +1919,7 @@
             }
 #elif defined(HOST_X86_64)
             {
-                char name[256];
+                char relname[256];
                 int type;
                 int addend;
                 int reloc_offset;
@@ -1927,22 +1927,22 @@
                 if (rel->r_offset >= start_offset &&
 		    rel->r_offset < start_offset + copy_size) {
                     sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name;
-                    get_reloc_expr(name, sizeof(name), sym_name);
+                    get_reloc_expr(relname, sizeof(relname), sym_name);
                     type = ELF32_R_TYPE(rel->r_info);
                     addend = rel->r_addend;
                     reloc_offset = rel->r_offset - start_offset;
                     switch(type) {
                     case R_X86_64_32:
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (uint32_t)%s + %d;\n", 
-                                reloc_offset, name, addend);
+                                reloc_offset, relname, addend);
                         break;
                     case R_X86_64_32S:
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (int32_t)%s + %d;\n", 
-                                reloc_offset, name, addend);
+                                reloc_offset, relname, addend);
                         break;
                     case R_X86_64_PC32:
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) + %d;\n", 
-                                reloc_offset, name, reloc_offset, addend);
+                                reloc_offset, relname, reloc_offset, addend);
                         break;
                     default:
                         error("unsupported X86_64 relocation (%d)", type);
@@ -1953,7 +1953,7 @@
 #elif defined(HOST_PPC)
             {
 #ifdef CONFIG_FORMAT_ELF
-                char name[256];
+                char relname[256];
                 int type;
                 int addend;
                 int reloc_offset;
@@ -1974,30 +1974,30 @@
                             continue;
                         }
                         
-                        get_reloc_expr(name, sizeof(name), sym_name);
+                        get_reloc_expr(relname, sizeof(relname), sym_name);
                         type = ELF32_R_TYPE(rel->r_info);
                         addend = rel->r_addend;
                         switch(type) {
                         case R_PPC_ADDR32:
                             fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
-                                    reloc_offset, name, addend);
+                                    reloc_offset, relname, addend);
                             break;
                         case R_PPC_ADDR16_LO:
                             fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = (%s + %d);\n", 
-                                    reloc_offset, name, addend);
+                                    reloc_offset, relname, addend);
                             break;
                         case R_PPC_ADDR16_HI:
                             fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = (%s + %d) >> 16;\n", 
-                                    reloc_offset, name, addend);
+                                    reloc_offset, relname, addend);
                             break;
                         case R_PPC_ADDR16_HA:
                             fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = (%s + %d + 0x8000) >> 16;\n", 
-                                    reloc_offset, name, addend);
+                                    reloc_offset, relname, addend);
                             break;
                         case R_PPC_REL24:
                             /* warning: must be at 32 MB distancy */
                             fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((%s - (long)(gen_code_ptr + %d) + %d) & 0x03fffffc);\n", 
-                                    reloc_offset, reloc_offset, name, reloc_offset, addend);
+                                    reloc_offset, reloc_offset, relname, reloc_offset, addend);
                             break;
                         default:
                             error("unsupported powerpc relocation (%d)", type);
@@ -2005,98 +2005,97 @@
                     }
                 }
 #elif defined(CONFIG_FORMAT_MACH)
-				struct scattered_relocation_info *scarel;
-				struct relocation_info * rel;
-				char final_sym_name[256];
-				const char *sym_name;
-				const char *p;
-				int slide, sslide;
-				int i;
-	
-				for(i = 0, rel = relocs; i < nb_relocs; i++, rel++) {
-					unsigned int offset, length, value = 0;
-					unsigned int type, pcrel, isym = 0;
-					unsigned int usesym = 0;
-				
-					if(R_SCATTERED & rel->r_address) {
-						scarel = (struct scattered_relocation_info*)rel;
-						offset = (unsigned int)scarel->r_address;
-						length = scarel->r_length;
-						pcrel = scarel->r_pcrel;
-						type = scarel->r_type;
-						value = scarel->r_value;
-					} else {
-						value = isym = rel->r_symbolnum;
-						usesym = (rel->r_extern);
-						offset = rel->r_address;
-						length = rel->r_length;
-						pcrel = rel->r_pcrel;
-						type = rel->r_type;
-					}
-				
-					slide = offset - start_offset;
-		
-					if (!(offset >= start_offset && offset < start_offset + size)) 
-						continue;  /* not in our range */
+                struct scattered_relocation_info *scarel;
+                struct relocation_info * rel;
+                char final_sym_name[256];
+                const char *sym_name;
+                const char *p;
+                int slide, sslide;
+                int i;
 
-					sym_name = get_reloc_name(rel, &sslide);
-					
-					if(usesym && symtab[isym].n_type & N_STAB)
-						continue; /* don't handle STAB (debug sym) */
-					
-					if (sym_name && strstart(sym_name, "__op_jmp", &p)) {
-						int n;
-						n = strtol(p, NULL, 10);
-						fprintf(outfile, "    jmp_offsets[%d] = %d + (gen_code_ptr - gen_code_buf);\n",
-							n, slide);
-						continue; /* Nothing more to do */
-					}
-					
-					if(!sym_name)
-					{
-						fprintf(outfile, "/* #warning relocation not handled in %s (value 0x%x, %s, offset 0x%x, length 0x%x, %s, type 0x%x) */\n",
-						           name, value, usesym ? "use sym" : "don't use sym", offset, length, pcrel ? "pcrel":"", type);
-						continue; /* dunno how to handle without final_sym_name */
-					}
-													   
-                                        get_reloc_expr(final_sym_name, sizeof(final_sym_name), 
-                                                       sym_name);
-					switch(type) {
-					case PPC_RELOC_BR24:
-					    if (!strstart(sym_name,"__op_gen_label",&p)) {
-    						fprintf(outfile, "{\n");
-    						fprintf(outfile, "    uint32_t imm = *(uint32_t *)(gen_code_ptr + %d) & 0x3fffffc;\n", slide);
-    						fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((imm + ((long)%s - (long)gen_code_ptr) + %d) & 0x03fffffc);\n", 
-											slide, slide, name, sslide );
-    						fprintf(outfile, "}\n");
-    					} else {
-							fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | (((long)%s - (long)gen_code_ptr - %d) & 0x03fffffc);\n",
-											slide, slide, final_sym_name, slide);
-    					}
-						break;
-					case PPC_RELOC_HI16:
-						fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d) >> 16;\n", 
-							slide, final_sym_name, sslide);
-						break;
-					case PPC_RELOC_LO16:
-						fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d);\n", 
-					slide, final_sym_name, sslide);
+                for(i = 0, rel = relocs; i < nb_relocs; i++, rel++) {
+                    unsigned int offset, length, value = 0;
+                    unsigned int type, pcrel, isym = 0;
+                    unsigned int usesym = 0;
+
+                    if(R_SCATTERED & rel->r_address) {
+                        scarel = (struct scattered_relocation_info*)rel;
+                        offset = (unsigned int)scarel->r_address;
+                        length = scarel->r_length;
+                        pcrel = scarel->r_pcrel;
+                        type = scarel->r_type;
+                        value = scarel->r_value;
+                    } else {
+                        value = isym = rel->r_symbolnum;
+                        usesym = (rel->r_extern);
+                        offset = rel->r_address;
+                        length = rel->r_length;
+                        pcrel = rel->r_pcrel;
+                        type = rel->r_type;
+                    }
+
+                    slide = offset - start_offset;
+
+                    if (!(offset >= start_offset && offset < start_offset + size)) 
+                        continue;  /* not in our range */
+
+                        sym_name = get_reloc_name(rel, &sslide);
+
+                        if(usesym && symtab[isym].n_type & N_STAB)
+                            continue; /* don't handle STAB (debug sym) */
+
+                        if (sym_name && strstart(sym_name, "__op_jmp", &p)) {
+                            int n;
+                            n = strtol(p, NULL, 10);
+                            fprintf(outfile, "    jmp_offsets[%d] = %d + (gen_code_ptr - gen_code_buf);\n",
+                                    n, slide);
+                            continue; /* Nothing more to do */
+                        }
+
+                        if(!sym_name) {
+                            fprintf(outfile, "/* #warning relocation not handled in %s (value 0x%x, %s, offset 0x%x, length 0x%x, %s, type 0x%x) */\n",
+                                    name, value, usesym ? "use sym" : "don't use sym", offset, length, pcrel ? "pcrel":"", type);
+                            continue; /* dunno how to handle without final_sym_name */
+                        }
+
+                        get_reloc_expr(final_sym_name, sizeof(final_sym_name), 
+                                       sym_name);
+                        switch(type) {
+                        case PPC_RELOC_BR24:
+                            if (!strstart(sym_name,"__op_gen_label",&p)) {
+                                fprintf(outfile, "{\n");
+                                fprintf(outfile, "    uint32_t imm = *(uint32_t *)(gen_code_ptr + %d) & 0x3fffffc;\n", slide);
+                                fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((imm + ((long)%s - (long)gen_code_ptr) + %d) & 0x03fffffc);\n",
+                                        slide, slide, name, sslide);
+                                fprintf(outfile, "}\n");
+                            } else {
+                                fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | (((long)%s - (long)gen_code_ptr - %d) & 0x03fffffc);\n",
+                                        slide, slide, final_sym_name, slide);
+                            }
                             break;
-					case PPC_RELOC_HA16:
-						fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d + 0x8000) >> 16;\n", 
-							slide, final_sym_name, sslide);
-						break;
-				default:
-					error("unsupported powerpc relocation (%d)", type);
-				}
-			}
+                        case PPC_RELOC_HI16:
+                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d) >> 16;\n", 
+                                    slide, final_sym_name, sslide);
+                            break;
+                        case PPC_RELOC_LO16:
+                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d);\n", 
+                                    slide, final_sym_name, sslide);
+                            break;
+                        case PPC_RELOC_HA16:
+                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d + 0x8000) >> 16;\n", 
+                                    slide, final_sym_name, sslide);
+                            break;
+                        default:
+                            error("unsupported powerpc relocation (%d)", type);
+                    }
+                }
 #else
 #error unsupport object format
 #endif
             }
 #elif defined(HOST_S390)
             {
-                char name[256];
+                char relname[256];
                 int type;
                 int addend;
                 int reloc_offset;
@@ -2104,22 +2103,22 @@
                     if (rel->r_offset >= start_offset &&
 			rel->r_offset < start_offset + copy_size) {
                         sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name;
-                        get_reloc_expr(name, sizeof(name), sym_name);
+                        get_reloc_expr(relname, sizeof(relname), sym_name);
                         type = ELF32_R_TYPE(rel->r_info);
                         addend = rel->r_addend;
                         reloc_offset = rel->r_offset - start_offset;
                         switch(type) {
                         case R_390_32:
                             fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
-                                    reloc_offset, name, addend);
+                                    reloc_offset, relname, addend);
                             break;
                         case R_390_16:
                             fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = %s + %d;\n", 
-                                    reloc_offset, name, addend);
+                                    reloc_offset, relname, addend);
                             break;
                         case R_390_8:
                             fprintf(outfile, "    *(uint8_t *)(gen_code_ptr + %d) = %s + %d;\n", 
-                                    reloc_offset, name, addend);
+                                    reloc_offset, relname, addend);
                             break;
                         default:
                             error("unsupported s390 relocation (%d)", type);
@@ -2187,7 +2186,7 @@
             {
 		unsigned long sym_idx;
 		long code_offset;
-                char name[256];
+                char relname[256];
                 int type;
                 long addend;
 
@@ -2210,7 +2209,7 @@
 				n, code_offset);
 			continue;
 		    }
-		    get_reloc_expr(name, sizeof(name), sym_name);
+		    get_reloc_expr(relname, sizeof(relname), sym_name);
 		    type = ELF64_R_TYPE(rel->r_info);
 		    addend = rel->r_addend;
 		    switch(type) {
@@ -2218,19 +2217,19 @@
 			  fprintf(outfile,
 				  "    ia64_imm64(gen_code_ptr + %ld, "
 				  "%s + %ld);\n",
-				  code_offset, name, addend);
+				  code_offset, relname, addend);
 			  break;
 		      case R_IA64_LTOFF22X:
 		      case R_IA64_LTOFF22:
 			  fprintf(outfile, "    IA64_LTOFF(gen_code_ptr + %ld,"
 				  " %s + %ld, %d);\n",
-				  code_offset, name, addend,
+				  code_offset, relname, addend,
 				  (type == R_IA64_LTOFF22X));
 			  break;
 		      case R_IA64_LDXMOV:
 			  fprintf(outfile,
 				  "    ia64_ldxmov(gen_code_ptr + %ld,"
-				  " %s + %ld);\n", code_offset, name, addend);
+				  " %s + %ld);\n", code_offset, relname, addend);
 			  break;
 
 		      case R_IA64_PCREL21B:
@@ -2239,7 +2238,7 @@
 				      "    ia64_imm21b(gen_code_ptr + %ld,"
 				      " (long) (%s + %ld -\n\t\t"
 				      "((long) gen_code_ptr + %ld)) >> 4);\n",
-				      code_offset, name, addend,
+				      code_offset, relname, addend,
 				      code_offset & ~0xfUL);
 			  } else {
 			      fprintf(outfile,
@@ -2260,7 +2259,7 @@
             }
 #elif defined(HOST_SPARC)
             {
-                char name[256];
+                char relname[256];
                 int type;
                 int addend;
                 int reloc_offset;
@@ -2268,14 +2267,14 @@
                     if (rel->r_offset >= start_offset &&
 			rel->r_offset < start_offset + copy_size) {
                         sym_name = strtab + symtab[ELF32_R_SYM(rel->r_info)].st_name;
-                        get_reloc_expr(name, sizeof(name), sym_name);
+                        get_reloc_expr(relname, sizeof(relname), sym_name);
                         type = ELF32_R_TYPE(rel->r_info);
                         addend = rel->r_addend;
                         reloc_offset = rel->r_offset - start_offset;
                         switch(type) {
                         case R_SPARC_32:
                             fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
-                                    reloc_offset, name, addend);
+                                    reloc_offset, relname, addend);
 			    break;
 			case R_SPARC_HI22:
                             fprintf(outfile,
@@ -2283,7 +2282,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + %d)) "
 				    " & ~0x3fffff) "
 				    " | (((%s + %d) >> 10) & 0x3fffff);\n",
-                                    reloc_offset, reloc_offset, name, addend);
+                                    reloc_offset, reloc_offset, relname, addend);
 			    break;
 			case R_SPARC_LO10:
                             fprintf(outfile,
@@ -2291,7 +2290,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + %d)) "
 				    " & ~0x3ff) "
 				    " | ((%s + %d) & 0x3ff);\n",
-                                    reloc_offset, reloc_offset, name, addend);
+                                    reloc_offset, reloc_offset, relname, addend);
 			    break;
 			case R_SPARC_WDISP30:
 			    fprintf(outfile,
@@ -2300,7 +2299,7 @@
 				    " & ~0x3fffffff) "
 				    " | ((((%s + %d) - (long)(gen_code_ptr + %d))>>2) "
 				    "    & 0x3fffffff);\n",
-				    reloc_offset, reloc_offset, name, addend,
+				    reloc_offset, reloc_offset, relname, addend,
 				    reloc_offset);
 			    break;
                         case R_SPARC_WDISP22:
@@ -2312,7 +2311,7 @@
                                     "    & 0x3fffff);\n",
                                     rel->r_offset - start_offset,
                                     rel->r_offset - start_offset,
-                                    name, addend,
+                                    relname, addend,
                                     rel->r_offset - start_offset);
                             break;
                         default:
@@ -2323,7 +2322,7 @@
             }
 #elif defined(HOST_SPARC64)
             {
-                char name[256];
+                char relname[256];
                 int type;
                 int addend;
                 int reloc_offset;
@@ -2331,14 +2330,14 @@
                     if (rel->r_offset >= start_offset &&
 			rel->r_offset < start_offset + copy_size) {
                         sym_name = strtab + symtab[ELF64_R_SYM(rel->r_info)].st_name;
-                        get_reloc_expr(name, sizeof(name), sym_name);
+                        get_reloc_expr(relname, sizeof(relname), sym_name);
                         type = ELF32_R_TYPE(rel->r_info);
                         addend = rel->r_addend;
                         reloc_offset = rel->r_offset - start_offset;
                         switch(type) {
                         case R_SPARC_32:
                             fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n",
-                                    reloc_offset, name, addend);
+                                    reloc_offset, relname, addend);
 			    break;
 			case R_SPARC_HI22:
                             fprintf(outfile,
@@ -2346,7 +2345,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + %d)) "
 				    " & ~0x3fffff) "
 				    " | (((%s + %d) >> 10) & 0x3fffff);\n",
-                                    reloc_offset, reloc_offset, name, addend);
+                                    reloc_offset, reloc_offset, relname, addend);
 			    break;
 			case R_SPARC_LO10:
                             fprintf(outfile,
@@ -2354,7 +2353,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + %d)) "
 				    " & ~0x3ff) "
 				    " | ((%s + %d) & 0x3ff);\n",
-                                    reloc_offset, reloc_offset, name, addend);
+                                    reloc_offset, reloc_offset, relname, addend);
 			    break;
                         case R_SPARC_OLO10:
                             addend += ELF64_R_TYPE_DATA (rel->r_info);
@@ -2363,7 +2362,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + %d)) "
 				    " & ~0x3ff) "
 				    " | ((%s + %d) & 0x3ff);\n",
-                                    reloc_offset, reloc_offset, name, addend);
+                                    reloc_offset, reloc_offset, relname, addend);
 			    break;
 			case R_SPARC_WDISP30:
 			    fprintf(outfile,
@@ -2372,7 +2371,7 @@
 				    " & ~0x3fffffff) "
 				    " | ((((%s + %d) - (long)(gen_code_ptr + %d))>>2) "
 				    "    & 0x3fffffff);\n",
-				    reloc_offset, reloc_offset, name, addend,
+				    reloc_offset, reloc_offset, relname, addend,
 				    reloc_offset);
 			    break;
                         case R_SPARC_WDISP22:
@@ -2382,7 +2381,7 @@
                                     " & ~0x3fffff) "
                                     " | ((((%s + %d) - (long)(gen_code_ptr + %d))>>2) "
                                     "    & 0x3fffff);\n",
-                                    reloc_offset, reloc_offset, name, addend,
+                                    reloc_offset, reloc_offset, relname, addend,
 				    reloc_offset);
                             break;
                         case R_SPARC_HH22:
@@ -2391,7 +2390,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + %d)) "
 				    " & ~0x00000000) "
 				    " | (((%s + %d) >> 42) & 0x00000000);\n",
-                                    reloc_offset, reloc_offset, name, addend);
+                                    reloc_offset, reloc_offset, relname, addend);
                              break;
 
 			case R_SPARC_LM22:
@@ -2400,7 +2399,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + %d)) "
 				    " & ~0x00000000) "
 				    " | (((%s + %d) >> 10) & 0x00000000);\n",
-                                    reloc_offset, reloc_offset, name, addend);
+                                    reloc_offset, reloc_offset, relname, addend);
 			    break;
 
 			case R_SPARC_HM10:
@@ -2409,18 +2408,18 @@
 				    "((*(uint32_t *)(gen_code_ptr + %d)) "
 				    " & ~0x00000000) "
 				    " | ((((%s + %d) >> 32 & 0x3ff)) & 0x00000000);\n",
-                                    reloc_offset, reloc_offset, name, addend);
+                                    reloc_offset, reloc_offset, relname, addend);
 			    break;
 
                         default:
-			    error("unsupported sparc64 relocation (%d) for symbol %s", type, name);
+			    error("unsupported sparc64 relocation (%d) for symbol %s", type, relname);
                         }
                     }
                 }
             }
 #elif defined(HOST_ARM)
             {
-                char name[256];
+                char relname[256];
                 int type;
                 int addend;
                 int reloc_offset;
@@ -2455,7 +2454,7 @@
                     fprintf(outfile,
                             "    *(uint32_t *)gen_code_ptr = 0x%x;\n", opcode);
                 }
-                arm_emit_ldr_info(name, start_offset, outfile, p_start, p_end,
+                arm_emit_ldr_info(relname, start_offset, outfile, p_start, p_end,
                                   relocs, nb_relocs);
 
                 for(i = 0, rel = relocs;i < nb_relocs; i++, rel++) {
@@ -2465,20 +2464,20 @@
                     /* the compiler leave some unnecessary references to the code */
                     if (sym_name[0] == '\0')
                         continue;
-                    get_reloc_expr(name, sizeof(name), sym_name);
+                    get_reloc_expr(relname, sizeof(relname), sym_name);
                     type = ELF32_R_TYPE(rel->r_info);
                     addend = get32((uint32_t *)(text + rel->r_offset));
                     reloc_offset = rel->r_offset - start_offset;
                     switch(type) {
                     case R_ARM_ABS32:
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
-                                reloc_offset, name, addend);
+                                reloc_offset, relname, addend);
                         break;
                     case R_ARM_PC24:
                     case R_ARM_JUMP24:
                     case R_ARM_CALL:
                         fprintf(outfile, "    arm_reloc_pc24((uint32_t *)(gen_code_ptr + %d), 0x%x, %s);\n", 
-                                reloc_offset, addend, name);
+                                reloc_offset, addend, relname);
                         break;
                     default:
                         error("unsupported arm relocation (%d)", type);
@@ -2488,7 +2487,7 @@
             }
 #elif defined(HOST_M68K)
             {
-                char name[256];
+                char relname[256];
                 int type;
                 int addend;
                 int reloc_offset;
@@ -2498,7 +2497,7 @@
 		    rel->r_offset < start_offset + copy_size) {
 		    sym = &(symtab[ELFW(R_SYM)(rel->r_info)]);
                     sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name;
-                    get_reloc_expr(name, sizeof(name), sym_name);
+                    get_reloc_expr(relname, sizeof(relname), sym_name);
                     type = ELF32_R_TYPE(rel->r_info);
                     addend = get32((uint32_t *)(text + rel->r_offset)) + rel->r_addend;
                     reloc_offset = rel->r_offset - start_offset;
@@ -2506,12 +2505,12 @@
                     case R_68K_32:
 		        fprintf(outfile, "    /* R_68K_32 RELOC, offset %x */\n", rel->r_offset) ;
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %#x;\n", 
-                                reloc_offset, name, addend );
+                                reloc_offset, relname, addend );
                         break;
                     case R_68K_PC32:
 		        fprintf(outfile, "    /* R_68K_PC32 RELOC, offset %x */\n", rel->r_offset);
                         fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %#x) + %#x;\n", 
-                                reloc_offset, name, reloc_offset, /*sym->st_value+*/ addend);
+                                reloc_offset, relname, reloc_offset, /*sym->st_value+*/ addend);
                         break;
                     default:
                         error("unsupported m68k relocation (%d)", type);
@@ -2523,7 +2522,7 @@
             {
                 for (i = 0, rel = relocs; i < nb_relocs; i++, rel++) {
 		    if (rel->r_offset >= start_offset && rel->r_offset < start_offset + copy_size) {
-                        char name[256];
+                        char relname[256];
                         int type;
                         int addend;
                         int reloc_offset;
@@ -2532,7 +2531,7 @@
                         /* the compiler leave some unnecessary references to the code */
                         if (sym_name[0] == '\0')
                             continue;
-                        get_reloc_expr(name, sizeof(name), sym_name);
+                        get_reloc_expr(relname, sizeof(relname), sym_name);
 			type = ELF32_R_TYPE(rel->r_info);
                         addend = get32((uint32_t *)(text + rel->r_offset));
                         reloc_offset = rel->r_offset - start_offset;
@@ -2545,7 +2544,7 @@
 				    "(0x%x & ~0x3fffff) "
 				    "| ((0x%x + ((%s - (*(uint32_t *)(gen_code_ptr + 0x%x))) >> 2)) "
 				    "   & 0x3fffff);\n",
-                                    reloc_offset, addend, addend, name, reloc_offset);
+                                    reloc_offset, addend, addend, relname, reloc_offset);
 			    break;
 			case R_MIPS_HI16:
                             fprintf(outfile, "    /* R_MIPS_HI16 RELOC, offset 0x%x, name %s */\n",
@@ -2555,7 +2554,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + 0x%x)) "
 				    " & ~0xffff) "
 				    " | (((%s - 0x8000) >> 16) & 0xffff);\n",
-                                    reloc_offset, reloc_offset, name);
+                                    reloc_offset, reloc_offset, relname);
 			    break;
 			case R_MIPS_LO16:
                             fprintf(outfile, "    /* R_MIPS_LO16 RELOC, offset 0x%x, name %s */\n",
@@ -2565,7 +2564,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + 0x%x)) "
 				    " & ~0xffff) "
 				    " | (%s & 0xffff);\n",
-                                    reloc_offset, reloc_offset, name);
+                                    reloc_offset, reloc_offset, relname);
 			    break;
 			case R_MIPS_PC16:
                             fprintf(outfile, "    /* R_MIPS_PC16 RELOC, offset 0x%x, name %s */\n",
@@ -2575,7 +2574,7 @@
 				    "(0x%x & ~0xffff) "
 				    "| ((0x%x + ((%s - (*(uint32_t *)(gen_code_ptr + 0x%x))) >> 2)) "
 				    "   & 0xffff);\n",
-                                    reloc_offset, addend, addend, name, reloc_offset);
+                                    reloc_offset, addend, addend, relname, reloc_offset);
 			    break;
 			case R_MIPS_GOT16:
 			case R_MIPS_CALL16:
@@ -2586,7 +2585,7 @@
 				    "((*(uint32_t *)(gen_code_ptr + 0x%x)) "
 				    " & ~0xffff) "
 				    " | (((%s - 0x8000) >> 16) & 0xffff);\n",
-                                    reloc_offset, reloc_offset, name);
+                                    reloc_offset, reloc_offset, relname);
 			    break;
 			default:
 			    error("unsupported MIPS relocation (%d)", type);

Modified: trunk/src/host/qemu-neo1973/gdbstub.c
===================================================================
--- trunk/src/host/qemu-neo1973/gdbstub.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/gdbstub.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -383,7 +383,10 @@
     }
     registers[64] = tswapl(env->pc);
     registers[65] = tswapl(env->npc);
-    registers[66] = tswapl(env->tstate[env->tl]);
+    registers[66] = tswapl(((uint64_t)GET_CCR(env) << 32) |
+                           ((env->asi & 0xff) << 24) |
+                           ((env->pstate & 0xfff) << 8) |
+                           GET_CWP64(env));
     registers[67] = tswapl(env->fsr);
     registers[68] = tswapl(env->fprs);
     registers[69] = tswapl(env->y);
@@ -427,7 +430,14 @@
     }
     env->pc = tswapl(registers[64]);
     env->npc = tswapl(registers[65]);
-    env->tstate[env->tl] = tswapl(registers[66]);
+    {
+        uint64_t tmp = tswapl(registers[66]);
+
+        PUT_CCR(env, tmp >> 32);
+        env->asi = (tmp >> 24) & 0xff;
+        env->pstate = (tmp >> 8) & 0xfff;
+        PUT_CWP64(env, tmp & 0xff);
+    }
     env->fsr = tswapl(registers[67]);
     env->fprs = tswapl(registers[68]);
     env->y = tswapl(registers[69]);
@@ -763,7 +773,9 @@
 #elif defined (TARGET_ARM)
             env->regs[15] = addr;
 #elif defined (TARGET_SH4)
-	    env->pc = addr;
+            env->pc = addr;
+#elif defined (TARGET_MIPS)
+            env->PC = addr;
 #endif
         }
 #ifdef CONFIG_USER_ONLY
@@ -774,7 +786,7 @@
 	return RS_IDLE;
     case 's':
         if (*p != '\0') {
-            addr = strtoul(p, (char **)&p, 16);
+            addr = strtoull(p, (char **)&p, 16);
 #if defined(TARGET_I386)
             env->eip = addr;
 #elif defined (TARGET_PPC)
@@ -785,7 +797,9 @@
 #elif defined (TARGET_ARM)
             env->regs[15] = addr;
 #elif defined (TARGET_SH4)
-	    env->pc = addr;
+            env->pc = addr;
+#elif defined (TARGET_MIPS)
+            env->PC = addr;
 #endif
         }
         cpu_single_step(env, 1);
@@ -1238,12 +1252,12 @@
     return 0;
 }
 #else
-static int gdb_chr_can_recieve(void *opaque)
+static int gdb_chr_can_receive(void *opaque)
 {
   return 1;
 }
 
-static void gdb_chr_recieve(void *opaque, const uint8_t *buf, int size)
+static void gdb_chr_receive(void *opaque, const uint8_t *buf, int size)
 {
     GDBState *s = opaque;
     int i;
@@ -1294,7 +1308,7 @@
     }
     s->env = first_cpu; /* XXX: allow to change CPU */
     s->chr = chr;
-    qemu_chr_add_handlers(chr, gdb_chr_can_recieve, gdb_chr_recieve,
+    qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive,
                           gdb_chr_event, s);
     qemu_add_vm_stop_handler(gdb_vm_stopped, s);
     return 0;

Modified: trunk/src/host/qemu-neo1973/hw/fdc.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/fdc.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/fdc.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -1268,7 +1268,7 @@
     memset(fdctrl->fifo, 0, FD_SECTOR_LEN);
     if (cur_drv->bs == NULL ||
         bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) {
-        FLOPPY_ERROR("formating sector %d\n", fd_sector(cur_drv));
+        FLOPPY_ERROR("formatting sector %d\n", fd_sector(cur_drv));
         fdctrl_stop_transfer(fdctrl, 0x60, 0x00, 0x00);
     } else {
 	if (cur_drv->sect == cur_drv->last_sect) {

Modified: trunk/src/host/qemu-neo1973/hw/gt64xxx.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/gt64xxx.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/gt64xxx.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -225,13 +225,63 @@
 
 typedef PCIHostState GT64120PCIState;
 
+#define PCI_MAPPING_ENTRY(regname)            \
+    target_phys_addr_t regname ##_start;      \
+    target_phys_addr_t regname ##_length;     \
+    int regname ##_handle
+
 typedef struct GT64120State {
     GT64120PCIState *pci;
     uint32_t regs[GT_REGS];
-    target_phys_addr_t PCI0IO_start;
-    target_phys_addr_t PCI0IO_length;
+    PCI_MAPPING_ENTRY(PCI0IO);
+    PCI_MAPPING_ENTRY(ISD);
 } GT64120State;
 
+/* Adjust range to avoid touching space which isn't mappable via PCI */
+/* XXX: Hardcoded values for Malta: 0x1e000000 - 0x1f100000
+                                    0x1fc00000 - 0x1fd00000  */
+static void check_reserved_space (target_phys_addr_t *start,
+                                  target_phys_addr_t *length)
+{
+    target_phys_addr_t begin = *start;
+    target_phys_addr_t end = *start + *length;
+
+    if (end >= 0x1e000000LL && end < 0x1f100000LL)
+        end = 0x1e000000LL;
+    if (begin >= 0x1e000000LL && begin < 0x1f100000LL)
+        begin = 0x1f100000LL;
+    if (end >= 0x1fc00000LL && end < 0x1fd00000LL)
+        end = 0x1fc00000LL;
+    if (begin >= 0x1fc00000LL && begin < 0x1fd00000LL)
+        begin = 0x1fd00000LL;
+    /* XXX: This is broken when a reserved range splits the requested range */
+    if (end >= 0x1f100000LL && begin < 0x1e000000LL)
+        end = 0x1e000000LL;
+    if (end >= 0x1fd00000LL && begin < 0x1fc00000LL)
+        end = 0x1fc00000LL;
+
+    *start = begin;
+    *length = end - begin;
+}
+
+static void gt64120_isd_mapping(GT64120State *s)
+{
+    target_phys_addr_t start = s->regs[GT_ISD] << 21;
+    target_phys_addr_t length = 0x1000;
+
+    if (s->ISD_length)
+        cpu_register_physical_memory(s->ISD_start, s->ISD_length,
+                                     IO_MEM_UNASSIGNED);
+    check_reserved_space(&start, &length);
+    length = 0x1000;
+    /* Map new address */
+    dprintf("ISD: %x@%x -> %x@%x, %x\n", s->ISD_length, s->ISD_start,
+            length, start, s->ISD_handle);
+    s->ISD_start = start;
+    s->ISD_length = length;
+    cpu_register_physical_memory(s->ISD_start, s->ISD_length, s->ISD_handle);
+}
+
 static void gt64120_pci_mapping(GT64120State *s)
 {
     /* Update IO mapping */
@@ -280,37 +330,39 @@
     case GT_PCI0M0LD:
         s->regs[GT_PCI0M0LD]    = val & 0x00007fff;
         s->regs[GT_PCI0M0REMAP] = val & 0x000007ff;
-        gt64120_pci_mapping(s);
         break;
     case GT_PCI0M1LD:
         s->regs[GT_PCI0M1LD]    = val & 0x00007fff;
         s->regs[GT_PCI0M1REMAP] = val & 0x000007ff;
-        gt64120_pci_mapping(s);
         break;
     case GT_PCI1IOLD:
         s->regs[GT_PCI1IOLD]    = val & 0x00007fff;
         s->regs[GT_PCI1IOREMAP] = val & 0x000007ff;
-        gt64120_pci_mapping(s);
         break;
     case GT_PCI1M0LD:
         s->regs[GT_PCI1M0LD]    = val & 0x00007fff;
         s->regs[GT_PCI1M0REMAP] = val & 0x000007ff;
-        gt64120_pci_mapping(s);
         break;
     case GT_PCI1M1LD:
         s->regs[GT_PCI1M1LD]    = val & 0x00007fff;
         s->regs[GT_PCI1M1REMAP] = val & 0x000007ff;
+        break;
+    case GT_PCI0IOHD:
+        s->regs[saddr] = val & 0x0000007f;
         gt64120_pci_mapping(s);
         break;
-    case GT_PCI0IOHD:
     case GT_PCI0M0HD:
     case GT_PCI0M1HD:
     case GT_PCI1IOHD:
     case GT_PCI1M0HD:
     case GT_PCI1M1HD:
         s->regs[saddr] = val & 0x0000007f;
-        gt64120_pci_mapping(s);
         break;
+    case GT_ISD:
+        s->regs[saddr] = val & 0x00007fff;
+        gt64120_isd_mapping(s);
+        break;
+
     case GT_PCI0IOREMAP:
     case GT_PCI0M0REMAP:
     case GT_PCI0M1REMAP:
@@ -318,7 +370,6 @@
     case GT_PCI1M0REMAP:
     case GT_PCI1M1REMAP:
         s->regs[saddr] = val & 0x000007ff;
-        gt64120_pci_mapping(s);
         break;
 
     /* CPU Error Report */
@@ -1026,6 +1077,7 @@
 
     /* Interrupt registers are all zeroed at reset */
 
+    gt64120_isd_mapping(s);
     gt64120_pci_mapping(s);
 }
 
@@ -1070,27 +1122,21 @@
 {
     GT64120State *s;
     PCIDevice *d;
-    int gt64120;
 
     s = qemu_mallocz(sizeof(GT64120State));
     s->pci = qemu_mallocz(sizeof(GT64120PCIState));
-    gt64120_reset(s);
 
     s->pci->bus = pci_register_bus(pci_gt64120_set_irq, pci_gt64120_map_irq,
                                    pic, 144, 4);
-
-    gt64120 = cpu_register_io_memory(0, gt64120_read,
-                                     gt64120_write, s);
-    cpu_register_physical_memory(0x1be00000LL, 0x1000, gt64120);
-
+    s->ISD_handle = cpu_register_io_memory(0, gt64120_read, gt64120_write, s);
     d = pci_register_device(s->pci->bus, "GT64120 PCI Bus", sizeof(PCIDevice),
                             0, gt64120_read_config, gt64120_write_config);
 
     /* FIXME: Malta specific hw assumptions ahead */
 
-    d->config[0x00] = 0xab; // vendor_id
+    d->config[0x00] = 0xab; /* vendor_id */
     d->config[0x01] = 0x11;
-    d->config[0x02] = 0x20; // device_id
+    d->config[0x02] = 0x20; /* device_id */
     d->config[0x03] = 0x46;
 
     d->config[0x04] = 0x00;
@@ -1113,6 +1159,8 @@
     d->config[0x27] = 0x14;
     d->config[0x3D] = 0x01;
 
+    gt64120_reset(s);
+
     register_savevm("GT64120 PCI Bus", 0, 1, gt64120_save, gt64120_load, d);
 
     return s->pci->bus;

Modified: trunk/src/host/qemu-neo1973/hw/i2c.h
===================================================================
--- trunk/src/host/qemu-neo1973/hw/i2c.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/i2c.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -10,7 +10,7 @@
     I2C_START_RECV,
     I2C_START_SEND,
     I2C_FINISH,
-    I2C_NACK /* Masker NACKed a recieve byte.  */
+    I2C_NACK /* Masker NACKed a receive byte.  */
 };
 
 typedef struct i2c_slave i2c_slave;

Modified: trunk/src/host/qemu-neo1973/hw/ide.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/ide.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/ide.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -1567,7 +1567,7 @@
         buf[1] = 0x80; /* removable */
         buf[2] = 0x00; /* ISO */
         buf[3] = 0x21; /* ATAPI-2 (XXX: put ATAPI-4 ?) */
-        buf[4] = 31; /* additionnal length */
+        buf[4] = 31; /* additional length */
         buf[5] = 0; /* reserved */
         buf[6] = 0; /* reserved */
         buf[7] = 0; /* reserved */

Modified: trunk/src/host/qemu-neo1973/hw/iommu.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/iommu.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/iommu.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -259,7 +259,7 @@
         return -EINVAL;
 
     for (i = 0; i < IOMMU_NREGS; i++)
-	qemu_put_be32s(f, &s->regs[i]);
+        qemu_get_be32s(f, &s->regs[i]);
     qemu_get_be64s(f, &s->iostart);
 
     return 0;

Modified: trunk/src/host/qemu-neo1973/hw/mips_malta.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/mips_malta.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/mips_malta.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -538,6 +538,15 @@
     stl_raw(p++, 0x34e70000 | (env->ram_size & 0xffff));           /* ori a3, a3, low(env->ram_size) */
 
     /* Load BAR registers as done by YAMON */
+    stl_raw(p++, 0x3c09b400);                                      /* lui t1, 0xb400 */
+
+#ifdef TARGET_WORDS_BIGENDIAN
+    stl_raw(p++, 0x3c08df00);                                      /* lui t0, 0xdf00 */
+#else
+    stl_raw(p++, 0x340800df);                                      /* ori t0, r0, 0x00df */
+#endif
+    stl_raw(p++, 0xad280068);                                      /* sw t0, 0x0068(t1) */
+
     stl_raw(p++, 0x3c09bbe0);                                      /* lui t1, 0xbbe0 */
 
 #ifdef TARGET_WORDS_BIGENDIAN

Modified: trunk/src/host/qemu-neo1973/hw/pl011.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/pl011.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/pl011.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -176,7 +176,7 @@
     }
 }
 
-static int pl011_can_recieve(void *opaque)
+static int pl011_can_receive(void *opaque)
 {
     pl011_state *s = (pl011_state *)opaque;
 
@@ -186,7 +186,7 @@
         return s->read_count < 1;
 }
 
-static void pl011_recieve(void *opaque, const uint8_t *buf, int size)
+static void pl011_receive(void *opaque, const uint8_t *buf, int size)
 {
     pl011_state *s = (pl011_state *)opaque;
     int slot;
@@ -241,7 +241,7 @@
     s->cr = 0x300;
     s->flags = 0x90;
     if (chr){ 
-        qemu_chr_add_handlers(chr, pl011_can_recieve, pl011_recieve,
+        qemu_chr_add_handlers(chr, pl011_can_receive, pl011_receive,
                               pl011_event, s);
     }
     /* ??? Save/restore.  */

Modified: trunk/src/host/qemu-neo1973/hw/pl181.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/pl181.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/pl181.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -160,7 +160,7 @@
             s->response[2] = RWORD(8);
             s->response[3] = RWORD(12) & ~1;
         }
-        DPRINTF("Response recieved\n");
+        DPRINTF("Response received\n");
         s->status |= PL181_STATUS_CMDRESPEND;
 #undef RWORD
     } else {
@@ -174,7 +174,7 @@
     s->status |= PL181_STATUS_CMDTIMEOUT;
 }
 
-/* Transfer data between teh card and the FIFO.  This is complicated by
+/* Transfer data between the card and the FIFO.  This is complicated by
    the FIFO holding 32-bit words and the card taking data in single byte
    chunks.  FIFO bytes are transferred in little-endian order.  */
    

Modified: trunk/src/host/qemu-neo1973/hw/pxa2xx.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/pxa2xx.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/pxa2xx.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -280,7 +280,7 @@
 
         case 1:
             /* Idle */
-            if (!(s->cm_regs[CCCR] & (1 << 31))) {	/* CPDIS */
+            if (!(s->cm_regs[CCCR >> 2] & (1 << 31))) {	/* CPDIS */
                 cpu_interrupt(s->env, CPU_INTERRUPT_HALT);
                 break;
             }
@@ -2057,7 +2057,7 @@
         s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds);
 
     s->cm_base = 0x41300000;
-    s->cm_regs[CCCR >> 4] = 0x02000210;	/* 416.0 MHz */
+    s->cm_regs[CCCR >> 2] = 0x02000210;	/* 416.0 MHz */
     s->clkcfg = 0x00000009;		/* Turbo mode active */
     iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn,
                     pxa2xx_cm_writefn, s);
@@ -2118,7 +2118,7 @@
     s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma);
 
     /* GPIO1 resets the processor */
-    /* The handler can be overriden by board-specific code */
+    /* The handler can be overridden by board-specific code */
     pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s);
     return s;
 }
@@ -2166,7 +2166,7 @@
         s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds);
 
     s->cm_base = 0x41300000;
-    s->cm_regs[CCCR >> 4] = 0x02000210;	/* 416.0 MHz */
+    s->cm_regs[CCCR >> 2] = 0x02000210;	/* 416.0 MHz */
     s->clkcfg = 0x00000009;		/* Turbo mode active */
     iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn,
                     pxa2xx_cm_writefn, s);
@@ -2227,7 +2227,7 @@
     s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma);
 
     /* GPIO1 resets the processor */
-    /* The handler can be overriden by board-specific code */
+    /* The handler can be overridden by board-specific code */
     pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s);
     return s;
 }

Modified: trunk/src/host/qemu-neo1973/hw/rtl8139.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/rtl8139.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/rtl8139.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -790,7 +790,7 @@
     RTL8139State *s = opaque;
     int avail;
 
-    /* Recieve (drop) packets if card is disabled.  */
+    /* Receive (drop) packets if card is disabled.  */
     if (!s->clock_enabled)
       return 1;
     if (!rtl8139_receiver_enabled(s))

Modified: trunk/src/host/qemu-neo1973/hw/sun4u.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/sun4u.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/sun4u.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -29,6 +29,7 @@
 #define INITRD_LOAD_ADDR     0x00300000
 #define PROM_SIZE_MAX        (512 * 1024)
 #define PROM_ADDR	     0x1fff0000000ULL
+#define PROM_VADDR	     0x000ffd00000ULL
 #define APB_SPECIAL_BASE     0x1fe00000000ULL
 #define APB_MEM_BASE	     0x1ff00000000ULL
 #define VGA_BASE	     (APB_MEM_BASE + 0x400000ULL)
@@ -244,7 +245,7 @@
 
     // OpenBIOS nvram variables
     // Variable partition
-    start = 252;
+    start = 256;
     m48t59_write(nvram, start, 0x70);
     NVRAM_set_string(nvram, start + 4, "system", 12);
 
@@ -313,6 +314,10 @@
     cpu_interrupt(env, CPU_INTERRUPT_TIMER);
 }
 
+static void dummy_cpu_set_irq(void *opaque, int irq, int level)
+{
+}
+
 static const int ide_iobase[2] = { 0x1f0, 0x170 };
 static const int ide_iobase2[2] = { 0x3f6, 0x376 };
 static const int ide_irq[2] = { 14, 15 };
@@ -340,6 +345,7 @@
     PCIBus *pci_bus;
     const sparc_def_t *def;
     QEMUBH *bh;
+    qemu_irq *irq;
 
     linux_boot = (kernel_filename != NULL);
 
@@ -377,7 +383,7 @@
                                  prom_offset | IO_MEM_ROM);
 
     snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAME);
-    ret = load_elf(buf, 0, NULL, NULL, NULL);
+    ret = load_elf(buf, PROM_ADDR - PROM_VADDR, NULL, NULL, NULL);
     if (ret < 0) {
 	fprintf(stderr, "qemu: could not load prom '%s'\n", 
 		buf);
@@ -441,7 +447,9 @@
 	pci_nic_init(pci_bus, &nd_table[i], -1);
     }
 
-    pci_cmd646_ide_init(pci_bus, bs_table, 1);
+    irq = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, 32);
+    // XXX pci_cmd646_ide_init(pci_bus, bs_table, 1);
+    pci_piix3_ide_init(pci_bus, bs_table, -1, irq);
     /* FIXME: wire up interrupts.  */
     i8042_init(NULL/*1*/, NULL/*12*/, 0x60);
     floppy_controller = fdctrl_init(NULL/*6*/, 2, 0, 0x3f0, fd_table);

Modified: trunk/src/host/qemu-neo1973/hw/tcx.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/tcx.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/tcx.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -354,9 +354,6 @@
 {
     TCXState *s = opaque;
     
-    qemu_put_be32s(f, (uint32_t *)&s->vram);
-    qemu_put_be32s(f, (uint32_t *)&s->vram24);
-    qemu_put_be32s(f, (uint32_t *)&s->cplane);
     qemu_put_be16s(f, (uint16_t *)&s->height);
     qemu_put_be16s(f, (uint16_t *)&s->width);
     qemu_put_be16s(f, (uint16_t *)&s->depth);
@@ -370,13 +367,16 @@
 static int tcx_load(QEMUFile *f, void *opaque, int version_id)
 {
     TCXState *s = opaque;
-    
-    if (version_id != 3)
+    uint32_t dummy;
+
+    if (version_id != 3 && version_id != 4)
         return -EINVAL;
 
-    qemu_get_be32s(f, (uint32_t *)&s->vram);
-    qemu_get_be32s(f, (uint32_t *)&s->vram24);
-    qemu_get_be32s(f, (uint32_t *)&s->cplane);
+    if (version_id == 3) {
+        qemu_get_be32s(f, (uint32_t *)&dummy);
+        qemu_get_be32s(f, (uint32_t *)&dummy);
+        qemu_get_be32s(f, (uint32_t *)&dummy);
+    }
     qemu_get_be16s(f, (uint16_t *)&s->height);
     qemu_get_be16s(f, (uint16_t *)&s->width);
     qemu_get_be16s(f, (uint16_t *)&s->depth);
@@ -546,7 +546,7 @@
     cpu_register_physical_memory(addr + 0x00301000ULL, TCX_THC_NREGS_24,
                                  dummy_memory);
 
-    register_savevm("tcx", addr, 3, tcx_save, tcx_load, s);
+    register_savevm("tcx", addr, 4, tcx_save, tcx_load, s);
     qemu_register_reset(tcx_reset, s);
     tcx_reset(s);
     dpy_resize(s->ds, width, height);

Modified: trunk/src/host/qemu-neo1973/hw/usb-ohci.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/usb-ohci.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/usb-ohci.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -120,6 +120,8 @@
     uint32_t done;
 };
 
+static void ohci_bus_stop(OHCIState *ohci);
+
 /* Bitfields for the first word of an Endpoint Desciptor.  */
 #define OHCI_ED_FA_SHIFT  0
 #define OHCI_ED_FA_MASK   (0x7f<<OHCI_ED_FA_SHIFT)
@@ -344,11 +346,13 @@
 }
 
 /* Reset the controller */
-static void ohci_reset(OHCIState *ohci)
+static void ohci_reset(void *opaque)
 {
+    OHCIState *ohci = opaque;
     OHCIPort *port;
     int i;
 
+    ohci_bus_stop(ohci);
     ohci->ctl = 0;
     ohci->old_ctl = 0;
     ohci->status = 0;
@@ -833,6 +837,7 @@
 {
     if (ohci->eof_timer)
         qemu_del_timer(ohci->eof_timer);
+    ohci->eof_timer = NULL;
 }
 
 /* Sets a flag in a port status register but only set it if the port is
@@ -918,6 +923,7 @@
         dprintf("usb-ohci: %s: USB Resume\n", ohci->name);
         break;
     case OHCI_USB_RESET:
+        ohci_reset(ohci);
         dprintf("usb-ohci: %s: USB Reset\n", ohci->name);
         break;
     }
@@ -1291,6 +1297,7 @@
     }
 
     ohci->async_td = 0;
+    qemu_register_reset(ohci_reset, ohci);
     ohci_reset(ohci);
 }
 

Modified: trunk/src/host/qemu-neo1973/hw/usb.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/usb.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/hw/usb.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -140,7 +140,7 @@
                     s->setup_state = SETUP_STATE_IDLE;
                     /* transfer OK */
                 } else {
-                    /* ignore additionnal output */
+                    /* ignore additional output */
                 }
                 break;
             case SETUP_STATE_DATA:

Modified: trunk/src/host/qemu-neo1973/linux-user/elfload.c
===================================================================
--- trunk/src/host/qemu-neo1973/linux-user/elfload.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/linux-user/elfload.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -893,6 +893,11 @@
     struct elf_shdr sechdr, symtab, strtab;
     char *strings;
     struct syminfo *s;
+#if (ELF_CLASS == ELFCLASS64)
+    // Disas uses 32 bit symbols
+    struct elf32_sym *syms32 = NULL;
+    struct elf_sym *sym;
+#endif
 
     lseek(fd, hdr->e_shoff, SEEK_SET);
     for (i = 0; i < hdr->e_shnum; i++) {
@@ -920,6 +925,10 @@
     /* Now know where the strtab and symtab are.  Snarf them. */
     s = malloc(sizeof(*s));
     s->disas_symtab = malloc(symtab.sh_size);
+#if (ELF_CLASS == ELFCLASS64)
+    syms32 = malloc(symtab.sh_size / sizeof(struct elf_sym)
+                    * sizeof(struct elf32_sym));
+#endif
     s->disas_strtab = strings = malloc(strtab.sh_size);
     if (!s->disas_symtab || !s->disas_strtab)
 	return;
@@ -928,11 +937,25 @@
     if (read(fd, s->disas_symtab, symtab.sh_size) != symtab.sh_size)
 	return;
 
+    for (i = 0; i < symtab.sh_size / sizeof(struct elf_sym); i++) {
 #ifdef BSWAP_NEEDED
-    for (i = 0; i < symtab.sh_size / sizeof(struct elf_sym); i++)
 	bswap_sym(s->disas_symtab + sizeof(struct elf_sym)*i);
 #endif
+#if (ELF_CLASS == ELFCLASS64)
+        sym = s->disas_symtab + sizeof(struct elf_sym)*i;
+        syms32[i].st_name = sym->st_name;
+        syms32[i].st_info = sym->st_info;
+        syms32[i].st_other = sym->st_other;
+        syms32[i].st_shndx = sym->st_shndx;
+        syms32[i].st_value = sym->st_value & 0xffffffff;
+        syms32[i].st_size = sym->st_size & 0xffffffff;
+#endif
+    }
 
+#if (ELF_CLASS == ELFCLASS64)
+    free(s->disas_symtab);
+    s->disas_symtab = syms32;
+#endif
     lseek(fd, strtab.sh_offset, SEEK_SET);
     if (read(fd, strings, strtab.sh_size) != strtab.sh_size)
 	return;

Modified: trunk/src/host/qemu-neo1973/linux-user/main.c
===================================================================
--- trunk/src/host/qemu-neo1973/linux-user/main.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/linux-user/main.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -620,7 +620,20 @@
         case TT_FILL: /* window underflow */
             restore_window(env);
             break;
-	    // XXX
+        case TT_TFAULT:
+        case TT_DFAULT:
+            {
+                info.si_signo = SIGSEGV;
+                info.si_errno = 0;
+                /* XXX: check env->error_code */
+                info.si_code = TARGET_SEGV_MAPERR;
+                if (trapnr == TT_DFAULT)
+                    info._sifields._sigfault._addr = env->dmmuregs[4];
+                else
+                    info._sifields._sigfault._addr = env->tpc[env->tl];
+                queue_signal(info.si_signo, &info);
+            }
+            break;
 #endif
         case EXCP_INTERRUPT:
             /* just indicate that signals should be handled asap */

Modified: trunk/src/host/qemu-neo1973/linux-user/signal.c
===================================================================
--- trunk/src/host/qemu-neo1973/linux-user/signal.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/linux-user/signal.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -207,6 +207,8 @@
         /* should never come here, but who knows. The information for
            the target is irrelevant */
         tinfo->_sifields._sigfault._addr = 0;
+    } else if (sig == SIGIO) {
+	tinfo->_sifields._sigpoll._fd = info->si_fd;
     } else if (sig >= TARGET_SIGRTMIN) {
         tinfo->_sifields._rt._pid = info->si_pid;
         tinfo->_sifields._rt._uid = info->si_uid;
@@ -228,6 +230,8 @@
         sig == SIGBUS || sig == SIGTRAP) {
         tinfo->_sifields._sigfault._addr = 
             tswapl(info->_sifields._sigfault._addr);
+    } else if (sig == SIGIO) {
+	tinfo->_sifields._sigpoll._fd = tswap32(info->_sifields._sigpoll._fd);
     } else if (sig >= TARGET_SIGRTMIN) {
         tinfo->_sifields._rt._pid = tswap32(info->_sifields._rt._pid);
         tinfo->_sifields._rt._uid = tswap32(info->_sifields._rt._uid);
@@ -244,7 +248,7 @@
 }
 
 /* XXX: we support only POSIX RT signals are used. */
-/* XXX: find a solution for 64 bit (additionnal malloced data is needed) */
+/* XXX: find a solution for 64 bit (additional malloced data is needed) */
 void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo)
 {
     info->si_signo = tswap32(tinfo->si_signo);

Modified: trunk/src/host/qemu-neo1973/linux-user/syscall.c
===================================================================
--- trunk/src/host/qemu-neo1973/linux-user/syscall.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/linux-user/syscall.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -145,6 +145,7 @@
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
 #define __NR_sys_syslog __NR_syslog
 #define __NR_sys_tgkill __NR_tgkill
+#define __NR_sys_tkill __NR_tkill
 
 #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
 #define __NR__llseek __NR_lseek
@@ -165,7 +166,12 @@
           loff_t *, res, uint, wh);
 _syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo)
 _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
+#ifdef TARGET_NR_tgkill
 _syscall3(int,sys_tgkill,int,tgid,int,pid,int,sig)
+#endif
+#ifdef TARGET_NR_tkill
+_syscall2(int,sys_tkill,int,tid,int,sig)
+#endif
 #ifdef __NR_exit_group
 _syscall1(int,exit_group,int,error_code)
 #endif
@@ -184,7 +190,7 @@
 extern int setgroups(int, gid_t *);
 
 /*
- * This list is the union of errno values overidden in asm-<arch>/errno.h
+ * This list is the union of errno values overridden in asm-<arch>/errno.h
  * minus the errnos that are not actually generic to all archs.
  */
 static uint16_t host_to_target_errno_table[1200] = {
@@ -275,12 +281,24 @@
     [ECANCELED]		= TARGET_ECANCELED,
     [ENOMEDIUM]		= TARGET_ENOMEDIUM,
     [EMEDIUMTYPE]	= TARGET_EMEDIUMTYPE,
+#ifdef ENOKEY
     [ENOKEY]		= TARGET_ENOKEY,
+#endif
+#ifdef EKEYEXPIRED
     [EKEYEXPIRED]	= TARGET_EKEYEXPIRED,
+#endif
+#ifdef EKEYREVOKED
     [EKEYREVOKED]	= TARGET_EKEYREVOKED,
+#endif
+#ifdef EKEYREJECTED
     [EKEYREJECTED]	= TARGET_EKEYREJECTED,
+#endif
+#ifdef EOWNERDEAD
     [EOWNERDEAD]	= TARGET_EOWNERDEAD,
+#endif
+#ifdef ENOTRECOVERABLE
     [ENOTRECOVERABLE]	= TARGET_ENOTRECOVERABLE,
+#endif
 	};
 
 static inline int host_to_target_errno(int err)
@@ -308,7 +326,7 @@
 
 void target_set_brk(target_ulong new_brk)
 {
-    target_original_brk = target_brk = new_brk;
+    target_original_brk = target_brk = HOST_PAGE_ALIGN(new_brk);
 }
 
 long do_brk(target_ulong new_brk)
@@ -3346,7 +3364,8 @@
             put_user(stfs.f_bavail, &target_stfs->f_bavail);
             put_user(stfs.f_files, &target_stfs->f_files);
             put_user(stfs.f_ffree, &target_stfs->f_ffree);
-            put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid);
+            put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid.val[0]);
+            put_user(stfs.f_fsid.__val[1], &target_stfs->f_fsid.val[1]);
             put_user(stfs.f_namelen, &target_stfs->f_namelen);
             unlock_user_struct(target_stfs, arg2, 1);
         }
@@ -3372,7 +3391,8 @@
             put_user(stfs.f_bavail, &target_stfs->f_bavail);
             put_user(stfs.f_files, &target_stfs->f_files);
             put_user(stfs.f_ffree, &target_stfs->f_ffree);
-            put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid);
+            put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid.val[0]);
+            put_user(stfs.f_fsid.__val[1], &target_stfs->f_fsid.val[1]);
             put_user(stfs.f_namelen, &target_stfs->f_namelen);
             unlock_user_struct(target_stfs, arg3, 0);
         }
@@ -3535,7 +3555,7 @@
                 struct target_stat *target_st;
 
                 lock_user_struct(target_st, arg2, 0);
-#if defined(TARGET_MIPS)
+#if defined(TARGET_MIPS) || defined(TARGET_SPARC64)
                 target_st->st_dev = tswap32(st.st_dev);
 #else
                 target_st->st_dev = tswap16(st.st_dev);
@@ -3545,6 +3565,10 @@
                 target_st->st_mode = tswapl(st.st_mode); /* XXX: check this */
                 target_st->st_uid = tswap32(st.st_uid);
                 target_st->st_gid = tswap32(st.st_gid);
+#elif defined(TARGET_SPARC64)
+                target_st->st_mode = tswap32(st.st_mode);
+                target_st->st_uid = tswap32(st.st_uid);
+                target_st->st_gid = tswap32(st.st_gid);
 #else
                 target_st->st_mode = tswap16(st.st_mode);
                 target_st->st_uid = tswap16(st.st_uid);
@@ -3554,6 +3578,9 @@
 		/* If this is the same on PPC, then just merge w/ the above ifdef */
                 target_st->st_nlink = tswapl(st.st_nlink);
                 target_st->st_rdev = tswapl(st.st_rdev);
+#elif defined(TARGET_SPARC64)
+                target_st->st_nlink = tswap32(st.st_nlink);
+                target_st->st_rdev = tswap32(st.st_rdev);
 #else
                 target_st->st_nlink = tswap16(st.st_nlink);
                 target_st->st_rdev = tswap16(st.st_rdev);
@@ -4606,6 +4633,12 @@
       break;
 #endif
 
+#ifdef TARGET_NR_tkill
+    case TARGET_NR_tkill:
+        ret = get_errno(sys_tkill((int)arg1, (int)arg2));
+        break;
+#endif
+
 #ifdef TARGET_NR_tgkill
     case TARGET_NR_tgkill:
 	ret = get_errno(sys_tgkill((int)arg1, (int)arg2, (int)arg3));

Modified: trunk/src/host/qemu-neo1973/linux-user/syscall_defs.h
===================================================================
--- trunk/src/host/qemu-neo1973/linux-user/syscall_defs.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/linux-user/syscall_defs.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -962,6 +962,57 @@
 } __attribute__ ((packed));
 #endif
 
+#elif defined(TARGET_SPARC64)
+struct target_stat {
+	unsigned int	st_dev;
+	target_ulong	st_ino;
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+	unsigned int	st_uid;
+	unsigned int	st_gid;
+	unsigned int	st_rdev;
+	target_long	st_size;
+	target_long	target_st_atime;
+	target_long	target_st_mtime;
+	target_long	target_st_ctime;
+	target_long	st_blksize;
+	target_long	st_blocks;
+	target_ulong	__unused4[2];
+};
+
+struct target_stat64 {
+	unsigned char	__pad0[6];
+	unsigned short	st_dev;
+
+	uint64_t	st_ino;
+	uint64_t	st_nlink;
+
+	unsigned int	st_mode;
+
+	unsigned int	st_uid;
+	unsigned int	st_gid;
+
+	unsigned char	__pad2[6];
+	unsigned short	st_rdev;
+
+        int64_t		st_size;
+	int64_t		st_blksize;
+
+	unsigned char	__pad4[4];
+	unsigned int	st_blocks;
+
+	target_ulong	target_st_atime;
+	target_ulong	__unused1;
+
+	target_ulong	target_st_mtime;
+	target_ulong	__unused2;
+
+	target_ulong	target_st_ctime;
+	target_ulong	__unused3;
+
+	target_ulong	__unused4[3];
+};
+
 #elif defined(TARGET_SPARC)
 
 struct target_stat {
@@ -1305,6 +1356,10 @@
 #error unsupported CPU
 #endif
 
+typedef struct {
+        int     val[2];
+} target_fsid_t;
+
 #ifdef TARGET_MIPS
 struct target_statfs {
 	target_long		f_type;
@@ -1317,7 +1372,7 @@
 	target_long		f_bavail;
 
 	/* Linux specials */
-	int	f_fsid;
+	target_fsid_t		f_fsid;
 	target_long		f_namelen;
 	target_long		f_spare[6];
 };
@@ -1332,7 +1387,7 @@
 	uint64_t	f_files;
 	uint64_t	f_ffree;
 	uint64_t	f_bavail;
-	int f_fsid;
+	target_fsid_t	f_fsid;
 	uint32_t	f_namelen;
 	uint32_t	f_spare[6];
 };
@@ -1345,7 +1400,7 @@
 	uint32_t f_bavail;
 	uint32_t f_files;
 	uint32_t f_ffree;
-	int f_fsid;
+	target_fsid_t f_fsid;
 	uint32_t f_namelen;
 	uint32_t f_frsize;
 	uint32_t f_spare[5];
@@ -1359,7 +1414,7 @@
 	uint64_t f_bavail;
 	uint64_t f_files;
 	uint64_t f_ffree;
-	int f_fsid;
+	target_fsid_t f_fsid;
         uint32_t f_namelen;
 	uint32_t f_frsize;
 	uint32_t f_spare[5];

Modified: trunk/src/host/qemu-neo1973/m68k-dis.c
===================================================================
--- trunk/src/host/qemu-neo1973/m68k-dis.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/m68k-dis.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -560,7 +560,7 @@
 };
 
 /* Name of register halves for MAC/EMAC.
-   Seperate from reg_names since 'spu', 'fpl' look weird.  */
+   Separate from reg_names since 'spu', 'fpl' look weird.  */
 static char *const reg_half_names[] =
 {
   "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",

Modified: trunk/src/host/qemu-neo1973/qemu-doc.texi
===================================================================
--- trunk/src/host/qemu-neo1973/qemu-doc.texi	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/qemu-doc.texi	2007-07-26 20:50:21 UTC (rev 2403)
@@ -555,8 +555,15 @@
 
 Available character devices are:
 @table @code
- at item vc
-Virtual console
+ at item vc[:WxH]
+Virtual console. Optionally, a width and height can be given in pixel with
+ at example
+vc:800x600
+ at end example
+It is also possible to specify width or height in characters:
+ at example
+vc:80Cx24C
+ at end example
 @item pty
 [Linux only] Pseudo TTY (a new PTY is automatically allocated)
 @item none
@@ -1559,11 +1566,11 @@
 
 @menu
 * QEMU PowerPC System emulator::
-* Sparc32 System emulator invocation::
-* Sparc64 System emulator invocation::
-* MIPS System emulator invocation::
-* ARM System emulator invocation::
-* ColdFire System emulator invocation::
+* Sparc32 System emulator::
+* Sparc64 System emulator::
+* MIPS System emulator::
+* ARM System emulator::
+* ColdFire System emulator::
 @end menu
 
 @node QEMU PowerPC System emulator
@@ -1631,8 +1638,8 @@
 More information is available at
 @url{http://perso.magic.fr/l_indien/qemu-ppc/}.
 
- at node Sparc32 System emulator invocation
- at section Sparc32 System emulator invocation
+ at node Sparc32 System emulator
+ at section Sparc32 System emulator
 
 Use the executable @file{qemu-system-sparc} to simulate a SparcStation 5
 or SparcStation 10 (sun4m architecture). The emulation is somewhat complete.
@@ -1698,8 +1705,8 @@
 
 @c man end 
 
- at node Sparc64 System emulator invocation
- at section Sparc64 System emulator invocation
+ at node Sparc64 System emulator
+ at section Sparc64 System emulator
 
 Use the executable @file{qemu-system-sparc64} to simulate a Sun4u machine.
 The emulator is not usable for anything yet.
@@ -1717,27 +1724,69 @@
 PC-compatible serial ports
 @end itemize
 
- at node MIPS System emulator invocation
- at section MIPS System emulator invocation
+ at node MIPS System emulator
+ at section MIPS System emulator
 
 Use the executable @file{qemu-system-mips} to simulate a MIPS machine.
-The emulator is able to boot a Linux kernel and to run a Linux Debian
-installation from NFS. The following devices are emulated:
+Three different machine types are emulated:
 
 @itemize @minus
+ at item
+A generic ISA PC-like machine "mips"
+ at item
+The MIPS Malta prototype board "malta"
+ at item
+An ACER Pica "pica61"
+ at end itemize
+
+The generic emulation is supported by Debian 'Etch' and is able to
+install Debian into a virtual disk image. The following devices are
+emulated:
+
+ at itemize @minus
 @item 
-MIPS R4K CPU
+MIPS 24Kf CPU
 @item
 PC style serial port
 @item
+PC style IDE disk
+ at item
 NE2000 network card
 @end itemize
 
-More information is available in the QEMU mailing-list archive.
+The Malta emulation supports the following devices:
 
- at node ARM System emulator invocation
- at section ARM System emulator invocation
+ at itemize @minus
+ at item
+Core board with MIPS 24Kf CPU and Galileo system controller
+ at item
+PIIX4 PCI/USB/SMbus controller
+ at item
+The Multi-I/O chip's serial device
+ at item
+PCnet32 PCI network card
+ at item
+Malta FPGA serial device
+ at item
+Cirrus VGA graphics card
+ at end itemize
 
+The ACER Pica emulation supports:
+
+ at itemize @minus
+ at item
+MIPS R4000 CPU
+ at item
+PC-style IRQ and DMA controllers
+ at item
+PC Keyboard
+ at item
+IDE controller
+ at end itemize
+
+ at node ARM System emulator
+ at section ARM System emulator
+
 Use the executable @file{qemu-system-arm} to simulate a ARM
 machine. The ARM Integrator/CP board is emulated with the following
 devices:
@@ -1844,8 +1893,8 @@
 A Linux 2.6 test image is available on the QEMU web site. More
 information is available in the QEMU mailing-list archive.
 
- at node ColdFire System emulator invocation
- at section ColdFire System emulator invocation
+ at node ColdFire System emulator
+ at section ColdFire System emulator
 
 Use the executable @file{qemu-system-m68k} to simulate a ColdFire machine.
 The emulator is able to boot a uClinux kernel.

Modified: trunk/src/host/qemu-neo1973/qemu-tech.texi
===================================================================
--- trunk/src/host/qemu-neo1973/qemu-tech.texi	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/qemu-tech.texi	2007-07-26 20:50:21 UTC (rev 2403)
@@ -35,6 +35,7 @@
 * intro_features::        Features
 * intro_x86_emulation::   x86 emulation
 * intro_arm_emulation::   ARM emulation
+* intro_mips_emulation::  MIPS emulation
 * intro_ppc_emulation::   PowerPC emulation
 * intro_sparc_emulation:: SPARC emulation
 @end menu
@@ -152,6 +153,33 @@
 
 @end itemize
 
+ at node intro_mips_emulation
+ at section MIPS emulation
+
+ at itemize
+
+ at item The system emulation allows full MIPS32/MIPS64 Release 2 emulation,
+including privileged instructions, FPU and MMU, in both little and big
+endian modes.
+
+ at item The Linux userland emulation can run many 32 bit MIPS Linux binaries.
+
+ at end itemize
+
+Current QEMU limitations:
+
+ at itemize
+
+ at item Self-modifying code is not always handled correctly.
+
+ at item 64 bit userland emulation is not implemented.
+
+ at item The system emulation is not complete enough to run real firmware.
+
+ at item The watchpoint debug facility is not implemented.
+
+ at end itemize
+
 @node intro_ppc_emulation
 @section PowerPC emulation
 
@@ -549,7 +577,7 @@
 @chapter Regression Tests
 
 In the directory @file{tests/}, various interesting testing programs
-are available. There are used for regression testing.
+are available. They are used for regression testing.
 
 @menu
 * test-i386::

Modified: trunk/src/host/qemu-neo1973/target-arm/op.c
===================================================================
--- trunk/src/host/qemu-neo1973/target-arm/op.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-arm/op.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -819,7 +819,7 @@
     int shift;
     shift = PARAM1;
     if (shift != 0) {
-	env->CF = (T1 >> (32 - shift)) & 1;
+	env->CF = (T0 >> (32 - shift)) & 1;
 	T0 = T0 << shift;
     }
     env->NZF = T0;
@@ -832,7 +832,7 @@
 
     shift = PARAM1;
     if (shift == 0) {
-	env->CF = ((uint32_t)shift) >> 31;
+	env->CF = ((uint32_t)T0) >> 31;
 	T0 = 0;
     } else {
 	env->CF = (T0 >> (shift - 1)) & 1;

Modified: trunk/src/host/qemu-neo1973/target-i386/cpu.h
===================================================================
--- trunk/src/host/qemu-neo1973/target-i386/cpu.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-i386/cpu.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -121,7 +121,7 @@
 #define VIP_MASK                0x00100000
 #define ID_MASK                 0x00200000
 
-/* hidden flags - used internally by qemu to represent additionnal cpu
+/* hidden flags - used internally by qemu to represent additional cpu
    states. Only the CPL, INHIBIT_IRQ and HALTED are not redundant. We avoid
    using the IOPL_MASK, TF_MASK and VM_MASK bit position to ease oring
    with eflags. */

Modified: trunk/src/host/qemu-neo1973/target-mips/TODO
===================================================================
--- trunk/src/host/qemu-neo1973/target-mips/TODO	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-mips/TODO	2007-07-26 20:50:21 UTC (rev 2403)
@@ -11,8 +11,6 @@
   in that case.
 - gdb breakpoints inside the emulated system work only due to a hack
   which disassembles over the end of the current tb.
-- Floating point results of ceil/floor/round are wrong for IEEE cornercases.
-- recip/rsqrt FPU instructions are not implemented
 
 MIPS64
 ------

Modified: trunk/src/host/qemu-neo1973/target-ppc/cpu.h
===================================================================
--- trunk/src/host/qemu-neo1973/target-ppc/cpu.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-ppc/cpu.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -693,7 +693,7 @@
     /* temporary fixed-point registers
      * used to emulate 64 bits target on 32 bits hosts
      */ 
-    target_ulong t0, t1, t2;
+    ppc_gpr_t t0, t1, t2;
 #endif
     ppc_avr_t t0_avr, t1_avr, t2_avr;
 

Modified: trunk/src/host/qemu-neo1973/target-ppc/exec.h
===================================================================
--- trunk/src/host/qemu-neo1973/target-ppc/exec.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-ppc/exec.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -43,15 +43,15 @@
 register unsigned long T2 asm(AREG3);
 #endif
 /* We may, sometime, need 64 bits registers on 32 bits target */
-#if defined(TARGET_PPC64) || defined(TARGET_PPCEMB) || (HOST_LONG_BITS == 64)
-#define T0_64 T0
-#define T1_64 T1
-#define T2_64 T2
-#else
+#if TARGET_GPR_BITS > HOST_LONG_BITS
 /* no registers can be used */
 #define T0_64 (env->t0)
 #define T1_64 (env->t1)
 #define T2_64 (env->t2)
+#else
+#define T0_64 T0
+#define T1_64 T1
+#define T2_64 T2
 #endif
 /* Provision for Altivec */
 #define T0_avr (env->t0_avr)

Modified: trunk/src/host/qemu-neo1973/target-ppc/helper.c
===================================================================
--- trunk/src/host/qemu-neo1973/target-ppc/helper.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-ppc/helper.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -1493,10 +1493,12 @@
         break;
     }
     if (enter_pm) {
-        /* power save: exit cpu loop */
-        env->halted = 1;
-        env->exception_index = EXCP_HLT;
-        cpu_loop_exit();
+        if (likely(!env->halted)) {
+            /* power save: exit cpu loop */
+            env->halted = 1;
+            env->exception_index = EXCP_HLT;
+            cpu_loop_exit();
+        }
     }
 }
 

Modified: trunk/src/host/qemu-neo1973/target-ppc/translate_init.c
===================================================================
--- trunk/src/host/qemu-neo1973/target-ppc/translate_init.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-ppc/translate_init.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -270,7 +270,8 @@
 
 /* 64 bits PowerPC specific SPRs */
 /* ASR */
-#if defined(TARGET_PPC64)
+/* Currently unused */
+#if 0 && defined(TARGET_PPC64)
 static void spr_read_asr (void *opaque, int sprn)
 {
     gen_op_load_asr();

Modified: trunk/src/host/qemu-neo1973/target-sparc/cpu.h
===================================================================
--- trunk/src/host/qemu-neo1973/target-sparc/cpu.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-sparc/cpu.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -10,7 +10,7 @@
 #else
 #define TARGET_LONG_BITS 64
 #define TARGET_FPREGS 64
-#define TARGET_PAGE_BITS 12 /* XXX */
+#define TARGET_PAGE_BITS 13 /* 8k */
 #endif
 
 #define TARGET_PHYS_ADDR_BITS 64
@@ -89,6 +89,7 @@
 #if defined(TARGET_SPARC64)
 #define PS_IG    (1<<11)
 #define PS_MG    (1<<10)
+#define PS_RMO   (1<<7)
 #define PS_RED   (1<<5)
 #define PS_PEF   (1<<4)
 #define PS_AM    (1<<3)
@@ -287,11 +288,15 @@
     } while (0)
 
 #ifdef TARGET_SPARC64
-#define GET_CCR(env) ((env->xcc << 4) | (env->psr & PSR_ICC))
+#define GET_CCR(env) (((env->xcc >> 20) << 4) | ((env->psr & PSR_ICC) >> 20))
 #define PUT_CCR(env, val) do { int _tmp = val;				\
-	env->xcc = _tmp >> 4;						\
+	env->xcc = (_tmp >> 4) << 20;						\
 	env->psr = (_tmp & 0xf) << 20;					\
     } while (0)
+#define GET_CWP64(env) (NWINDOWS - 1 - (env)->cwp)
+#define PUT_CWP64(env, val) \
+    cpu_set_cwp(env, NWINDOWS - 1 - ((val) & (NWINDOWS - 1)))
+
 #endif
 
 int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);

Modified: trunk/src/host/qemu-neo1973/target-sparc/op.c
===================================================================
--- trunk/src/host/qemu-neo1973/target-sparc/op.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-sparc/op.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -1184,12 +1184,12 @@
 // order.
 void OPPROTO op_rdcwp(void)
 {
-    T0 = NWINDOWS - 1 - env->cwp;
+    T0 = GET_CWP64(env);
 }
 
 void OPPROTO op_wrcwp(void)
 {
-    env->cwp = NWINDOWS - 1 - T0;
+    PUT_CWP64(env, T0);
 }
 
 /* XXX: use another pointer for %iN registers to avoid slow wrapping
@@ -1518,10 +1518,7 @@
 
 void OPPROTO op_movl_npc_T0(void)
 {
-    if (T0 & 0x3)
-	raise_exception(TT_UNALIGNED);
-    else
-	env->npc = T0;
+    env->npc = T0;
 }
 
 void OPPROTO op_mov_pc_npc(void)
@@ -2368,3 +2365,15 @@
 VIS_CMPOP(op_fcmpne, FCMPNE)
 
 #endif
+
+#define CHECK_ALIGN_OP(align)                           \
+    void OPPROTO op_check_align_T0_ ## align (void)     \
+    {                                                   \
+        if (T0 & align)                                 \
+            raise_exception(TT_UNALIGNED);              \
+        FORCE_RET();                                    \
+    }
+
+CHECK_ALIGN_OP(1)
+CHECK_ALIGN_OP(3)
+CHECK_ALIGN_OP(7)

Modified: trunk/src/host/qemu-neo1973/target-sparc/op_helper.c
===================================================================
--- trunk/src/host/qemu-neo1973/target-sparc/op_helper.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-sparc/op_helper.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -845,12 +845,11 @@
     }
 }
 
-void do_wrpstate()
+static inline void change_pstate(uint64_t new_pstate)
 {
-    uint64_t new_pstate, pstate_regs, new_pstate_regs;
+    uint64_t pstate_regs, new_pstate_regs;
     uint64_t *src, *dst;
 
-    new_pstate = T0 & 0xf3f;
     pstate_regs = env->pstate & 0xc01;
     new_pstate_regs = new_pstate & 0xc01;
     if (new_pstate_regs != pstate_regs) {
@@ -863,6 +862,11 @@
     env->pstate = new_pstate;
 }
 
+void do_wrpstate(void)
+{
+    change_pstate(T0 & 0xf3f);
+}
+
 void do_done(void)
 {
     env->tl--;
@@ -870,8 +874,8 @@
     env->npc = env->tnpc[env->tl] + 4;
     PUT_CCR(env, env->tstate[env->tl] >> 32);
     env->asi = (env->tstate[env->tl] >> 24) & 0xff;
-    env->pstate = (env->tstate[env->tl] >> 8) & 0xfff;
-    set_cwp(env->tstate[env->tl] & 0xff);
+    change_pstate((env->tstate[env->tl] >> 8) & 0xf3f);
+    PUT_CWP64(env, env->tstate[env->tl] & 0xff);
 }
 
 void do_retry(void)
@@ -881,8 +885,8 @@
     env->npc = env->tnpc[env->tl];
     PUT_CCR(env, env->tstate[env->tl] >> 32);
     env->asi = (env->tstate[env->tl] >> 24) & 0xff;
-    env->pstate = (env->tstate[env->tl] >> 8) & 0xfff;
-    set_cwp(env->tstate[env->tl] & 0xff);
+    change_pstate((env->tstate[env->tl] >> 8) & 0xf3f);
+    PUT_CWP64(env, env->tstate[env->tl] & 0xff);
 }
 #endif
 
@@ -952,11 +956,18 @@
     }
 #endif
     env->tstate[env->tl] = ((uint64_t)GET_CCR(env) << 32) | ((env->asi & 0xff) << 24) |
-	((env->pstate & 0xfff) << 8) | (env->cwp & 0xff);
+	((env->pstate & 0xf3f) << 8) | GET_CWP64(env);
     env->tpc[env->tl] = env->pc;
     env->tnpc[env->tl] = env->npc;
     env->tt[env->tl] = intno;
-    env->pstate = PS_PEF | PS_PRIV | PS_AG;
+    change_pstate(PS_PEF | PS_PRIV | PS_AG);
+
+    if (intno == TT_CLRWIN)
+        set_cwp((env->cwp - 1) & (NWINDOWS - 1));
+    else if ((intno & 0x1c0) == TT_SPILL)
+        set_cwp((env->cwp - env->cansave - 2) & (NWINDOWS - 1));
+    else if ((intno & 0x1c0) == TT_FILL)
+        set_cwp((env->cwp + 1) & (NWINDOWS - 1));
     env->tbr &= ~0x7fffULL;
     env->tbr |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5);
     if (env->tl < MAXTL - 1) {

Modified: trunk/src/host/qemu-neo1973/target-sparc/op_mem.h
===================================================================
--- trunk/src/host/qemu-neo1973/target-sparc/op_mem.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-sparc/op_mem.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -103,6 +103,11 @@
     T2 = tmp;
 }
 
+void OPPROTO glue(op_lduw, MEMSUFFIX)(void)
+{
+    T1 = (uint64_t)(glue(ldl, MEMSUFFIX)(T0) & 0xffffffff);
+}
+
 void OPPROTO glue(op_ldsw, MEMSUFFIX)(void)
 {
     T1 = (int64_t)(glue(ldl, MEMSUFFIX)(T0) & 0xffffffff);

Modified: trunk/src/host/qemu-neo1973/target-sparc/translate.c
===================================================================
--- trunk/src/host/qemu-neo1973/target-sparc/translate.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/target-sparc/translate.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -84,7 +84,7 @@
     GET_FIELD(X, 31 - (TO), 31 - (FROM))
 
 #define GET_FIELDs(x,a,b) sign_extend (GET_FIELD(x,a,b), (b) - (a) + 1)
-#define GET_FIELD_SPs(x,a,b) sign_extend (GET_FIELD_SP(x,a,b), 32 - ((b) - (a) + 1))
+#define GET_FIELD_SPs(x,a,b) sign_extend (GET_FIELD_SP(x,a,b), ((b) - (a) + 1))
 
 #ifdef TARGET_SPARC64
 #define DFPREG(r) (((r & 1) << 6) | (r & 0x1e))
@@ -346,6 +346,13 @@
 GEN32(gen_op_store_DT0_fpr, gen_op_store_DT0_fpr_fprf);
 GEN32(gen_op_store_DT1_fpr, gen_op_store_DT1_fpr_fprf);
 
+#ifdef ALIGN_7_BUGS_FIXED
+#else
+#ifndef CONFIG_USER_ONLY
+#define gen_op_check_align_T0_7()
+#endif
+#endif
+
 #ifdef TARGET_SPARC64
 // 'a' versions allowed to user depending on asi
 #if defined(CONFIG_USER_ONLY)
@@ -470,6 +477,7 @@
 OP_LD_TABLE(lddf);
 
 #ifdef TARGET_SPARC64
+OP_LD_TABLE(lduw);
 OP_LD_TABLE(ldsw);
 OP_LD_TABLE(ldx);
 OP_LD_TABLE(stx);
@@ -2226,7 +2234,7 @@
 			    gen_movl_reg_T0(rs1);
 			    gen_cond_reg(cond);
 			    if (IS_IMM) {	/* immediate */
-				rs2 = GET_FIELD_SPs(insn, 0, 10);
+				rs2 = GET_FIELD_SPs(insn, 0, 9);
 				gen_movl_simm_T1(rs2);
 			    }
 			    else {
@@ -2650,6 +2658,7 @@
 #ifdef TARGET_SPARC64
 	    } else if (xop == 0x39) { /* V9 return */
                 rs1 = GET_FIELD(insn, 13, 17);
+                save_state(dc);
 		gen_movl_reg_T0(rs1);
                 if (IS_IMM) {	/* immediate */
 		    rs2 = GET_FIELDs(insn, 19, 31);
@@ -2674,6 +2683,7 @@
                 }
 		gen_op_restore();
 		gen_mov_pc_npc(dc);
+                gen_op_check_align_T0_3();
 		gen_op_movl_npc_T0();
 		dc->npc = DYNAMIC_PC;
 		goto jmp_insn;
@@ -2718,6 +2728,7 @@
 			    gen_movl_T1_reg(rd);
 			}
                         gen_mov_pc_npc(dc);
+                        gen_op_check_align_T0_3();
 			gen_op_movl_npc_T0();
 			dc->npc = DYNAMIC_PC;
 		    }
@@ -2728,6 +2739,7 @@
 			if (!supervisor(dc))
 			    goto priv_insn;
                         gen_mov_pc_npc(dc);
+                        gen_op_check_align_T0_3();
 			gen_op_movl_npc_T0();
 			dc->npc = DYNAMIC_PC;
 			gen_op_rett();
@@ -2810,15 +2822,26 @@
                 (xop > 0x2c && xop <= 0x33) || xop == 0x1f || xop == 0x3d) {
 		switch (xop) {
 		case 0x0:	/* load word */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
+#ifndef TARGET_SPARC64
 		    gen_op_ldst(ld);
+#else
+                    gen_op_ldst(lduw);
+#endif
 		    break;
 		case 0x1:	/* load unsigned byte */
 		    gen_op_ldst(ldub);
 		    break;
 		case 0x2:	/* load unsigned halfword */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_1();
+#endif
 		    gen_op_ldst(lduh);
 		    break;
 		case 0x3:	/* load double word */
+                    gen_op_check_align_T0_7();
 		    if (rd & 1)
                         goto illegal_insn;
 		    gen_op_ldst(ldd);
@@ -2828,12 +2851,18 @@
 		    gen_op_ldst(ldsb);
 		    break;
 		case 0xa:	/* load signed halfword */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_1();
+#endif
 		    gen_op_ldst(ldsh);
 		    break;
 		case 0xd:	/* ldstub -- XXX: should be atomically */
 		    gen_op_ldst(ldstub);
 		    break;
 		case 0x0f:	/* swap register with memory. Also atomically */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_movl_reg_T1(rd);
 		    gen_op_ldst(swap);
 		    break;
@@ -2844,8 +2873,16 @@
 			goto illegal_insn;
 		    if (!supervisor(dc))
 			goto priv_insn;
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
 #endif
 		    gen_op_lda(insn, 1, 4, 0);
+#else
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
+                    gen_op_lduwa(insn, 1, 4, 0);
+#endif
 		    break;
 		case 0x11:	/* load unsigned byte alternate */
 #ifndef TARGET_SPARC64
@@ -2863,6 +2900,9 @@
 		    if (!supervisor(dc))
 			goto priv_insn;
 #endif
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_1();
+#endif
 		    gen_op_lduha(insn, 1, 2, 0);
 		    break;
 		case 0x13:	/* load double word alternate */
@@ -2874,6 +2914,7 @@
 #endif
 		    if (rd & 1)
                         goto illegal_insn;
+                    gen_op_check_align_T0_7();
 		    gen_op_ldda(insn, 1, 8, 0);
 		    gen_movl_T0_reg(rd + 1);
 		    break;
@@ -2893,6 +2934,9 @@
 		    if (!supervisor(dc))
 			goto priv_insn;
 #endif
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_1();
+#endif
 		    gen_op_ldsha(insn, 1, 2 ,1);
 		    break;
 		case 0x1d:	/* ldstuba -- XXX: should be atomically */
@@ -2912,6 +2956,9 @@
 			goto priv_insn;
 #endif
 		    gen_movl_reg_T1(rd);
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_swapa(insn, 1, 4, 0);
 		    break;
 
@@ -2926,6 +2973,7 @@
                     (void) &gen_op_ldfa;
                     (void) &gen_op_lddfa;
 #else
+                    (void) &gen_op_lda;
 #if !defined(CONFIG_USER_ONLY)
 		    (void) &gen_op_cas;
 		    (void) &gen_op_casx;
@@ -2934,23 +2982,35 @@
 #endif
 #ifdef TARGET_SPARC64
 		case 0x08: /* V9 ldsw */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_ldst(ldsw);
 		    break;
 		case 0x0b: /* V9 ldx */
+                    gen_op_check_align_T0_7();
 		    gen_op_ldst(ldx);
 		    break;
 		case 0x18: /* V9 ldswa */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_ldswa(insn, 1, 4, 1);
 		    break;
 		case 0x1b: /* V9 ldxa */
+                    gen_op_check_align_T0_7();
 		    gen_op_ldxa(insn, 1, 8, 0);
 		    break;
 		case 0x2d: /* V9 prefetch, no effect */
 		    goto skip_move;
 		case 0x30: /* V9 ldfa */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_ldfa(insn, 1, 8, 0); // XXX
 		    break;
 		case 0x33: /* V9 lddfa */
+                    gen_op_check_align_T0_7();
 		    gen_op_lddfa(insn, 1, 8, 0); // XXX
 
 		    break;
@@ -2971,16 +3031,23 @@
                     goto jmp_insn;
 		switch (xop) {
 		case 0x20:	/* load fpreg */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_ldst(ldf);
 		    gen_op_store_FT0_fpr(rd);
 		    break;
 		case 0x21:	/* load fsr */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_ldst(ldf);
 		    gen_op_ldfsr();
 		    break;
 		case 0x22:      /* load quad fpreg */
 		    goto nfpu_insn;
 		case 0x23:	/* load double fpreg */
+                    gen_op_check_align_T0_7();
 		    gen_op_ldst(lddf);
 		    gen_op_store_DT0_fpr(DFPREG(rd));
 		    break;
@@ -2992,17 +3059,24 @@
 		gen_movl_reg_T1(rd);
 		switch (xop) {
 		case 0x4:
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_ldst(st);
 		    break;
 		case 0x5:
 		    gen_op_ldst(stb);
 		    break;
 		case 0x6:
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_1();
+#endif
 		    gen_op_ldst(sth);
 		    break;
 		case 0x7:
 		    if (rd & 1)
                         goto illegal_insn;
+                    gen_op_check_align_T0_7();
                     flush_T2(dc);
 		    gen_movl_reg_T2(rd + 1);
 		    gen_op_ldst(std);
@@ -3015,6 +3089,9 @@
 		    if (!supervisor(dc))
 			goto priv_insn;
 #endif
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_sta(insn, 0, 4, 0);
                     break;
 		case 0x15:
@@ -3033,6 +3110,9 @@
 		    if (!supervisor(dc))
 			goto priv_insn;
 #endif
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_1();
+#endif
 		    gen_op_stha(insn, 0, 2, 0);
                     break;
 		case 0x17:
@@ -3044,6 +3124,7 @@
 #endif
 		    if (rd & 1)
                         goto illegal_insn;
+                    gen_op_check_align_T0_7();
                     flush_T2(dc);
 		    gen_movl_reg_T2(rd + 1);
 		    gen_op_stda(insn, 0, 8, 0);
@@ -3051,9 +3132,11 @@
 #endif
 #ifdef TARGET_SPARC64
 		case 0x0e: /* V9 stx */
+                    gen_op_check_align_T0_7();
 		    gen_op_ldst(stx);
 		    break;
 		case 0x1e: /* V9 stxa */
+                    gen_op_check_align_T0_7();
 		    gen_op_stxa(insn, 0, 8, 0); // XXX
 		    break;
 #endif
@@ -3065,10 +3148,16 @@
                     goto jmp_insn;
 		switch (xop) {
 		case 0x24:
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
                     gen_op_load_fpr_FT0(rd);
 		    gen_op_ldst(stf);
 		    break;
 		case 0x25: /* stfsr, V9 stxfsr */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_stfsr();
 		    gen_op_ldst(stf);
 		    break;
@@ -3081,6 +3170,7 @@
 		    goto nfq_insn;
 #endif
 		case 0x27:
+                    gen_op_check_align_T0_7();
                     gen_op_load_fpr_DT0(DFPREG(rd));
 		    gen_op_ldst(stdf);
 		    break;
@@ -3091,15 +3181,23 @@
 		switch (xop) {
 #ifdef TARGET_SPARC64
 		case 0x34: /* V9 stfa */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_stfa(insn, 0, 0, 0); // XXX
 		    break;
 		case 0x37: /* V9 stdfa */
+                    gen_op_check_align_T0_7();
 		    gen_op_stdfa(insn, 0, 0, 0); // XXX
 		    break;
 		case 0x3c: /* V9 casa */
+#ifdef CONFIG_USER_ONLY
+                    gen_op_check_align_T0_3();
+#endif
 		    gen_op_casa(insn, 0, 4, 0); // XXX
 		    break;
 		case 0x3e: /* V9 casxa */
+                    gen_op_check_align_T0_7();
 		    gen_op_casxa(insn, 0, 8, 0); // XXX
 		    break;
 		case 0x36: /* V9 stqfa */
@@ -3315,8 +3413,10 @@
 #if defined(CONFIG_USER_ONLY)
     env->user_mode_only = 1;
 #ifdef TARGET_SPARC64
-    env->cleanwin = NWINDOWS - 1;
-    env->cansave = NWINDOWS - 1;
+    env->cleanwin = NWINDOWS - 2;
+    env->cansave = NWINDOWS - 2;
+    env->pstate = PS_RMO | PS_PEF | PS_IE;
+    env->asi = 0x82; // Primary no-fault
 #endif
 #else
     env->psret = 0;

Modified: trunk/src/host/qemu-neo1973/vl.c
===================================================================
--- trunk/src/host/qemu-neo1973/vl.c	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/vl.c	2007-07-26 20:50:21 UTC (rev 2403)
@@ -2925,7 +2925,9 @@
     const char *p;
 
     if (!strcmp(filename, "vc")) {
-        return text_console_init(&display_state);
+        return text_console_init(&display_state, 0);
+    } else if (strstart(filename, "vc:", &p)) {
+        return text_console_init(&display_state, p);
     } else if (!strcmp(filename, "null")) {
         return qemu_chr_open_null();
     } else 
@@ -8192,7 +8194,7 @@
                         devname);
                 exit(1);
             }
-            if (!strcmp(devname, "vc"))
+            if (strstart(devname, "vc", 0))
                 qemu_chr_printf(serial_hds[i], "serial%d console\r\n", i);
         }
     }
@@ -8206,7 +8208,7 @@
                         devname);
                 exit(1);
             }
-            if (!strcmp(devname, "vc"))
+            if (strstart(devname, "vc", 0))
                 qemu_chr_printf(parallel_hds[i], "parallel%d console\r\n", i);
         }
     }

Modified: trunk/src/host/qemu-neo1973/vl.h
===================================================================
--- trunk/src/host/qemu-neo1973/vl.h	2007-07-26 19:03:24 UTC (rev 2402)
+++ trunk/src/host/qemu-neo1973/vl.h	2007-07-26 20:50:21 UTC (rev 2403)
@@ -353,7 +353,7 @@
 void vga_hw_screen_dump(const char *filename);
 
 int is_graphic_console(void);
-CharDriverState *text_console_init(DisplayState *ds);
+CharDriverState *text_console_init(DisplayState *ds, const char *p);
 void console_select(unsigned int index);
 
 /* serial ports */





More information about the commitlog mailing list