XER is to be treated as a 64 bits register on 64 bits implementations,
[qemu] / hw / tcx.c
index 675c74d..9a72d6a 100644 (file)
--- a/hw/tcx.c
+++ b/hw/tcx.c
@@ -1,8 +1,8 @@
 /*
  * QEMU TCX Frame buffer
- * 
+ *
  * Copyright (c) 2003-2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -83,7 +83,7 @@ static void update_palette_entries(TCXState *s, int start, int end)
         tcx_invalidate_display(s);
 }
 
-static void tcx_draw_line32(TCXState *s1, uint8_t *d, 
+static void tcx_draw_line32(TCXState *s1, uint8_t *d,
                            const uint8_t *s, int width)
 {
     int x;
@@ -96,7 +96,7 @@ static void tcx_draw_line32(TCXState *s1, uint8_t *d,
     }
 }
 
-static void tcx_draw_line16(TCXState *s1, uint8_t *d, 
+static void tcx_draw_line16(TCXState *s1, uint8_t *d,
                            const uint8_t *s, int width)
 {
     int x;
@@ -109,7 +109,7 @@ static void tcx_draw_line16(TCXState *s1, uint8_t *d,
     }
 }
 
-static void tcx_draw_line8(TCXState *s1, uint8_t *d, 
+static void tcx_draw_line8(TCXState *s1, uint8_t *d,
                           const uint8_t *s, int width)
 {
     int x;
@@ -180,7 +180,7 @@ static void tcx_update_display(void *opaque)
     ram_addr_t page, page_min, page_max;
     int y, y_start, dd, ds;
     uint8_t *d, *s;
-    void (*f)(TCXState *s1, uint8_t *d, const uint8_t *s, int width);
+    void (*f)(TCXState *s1, uint8_t *dst, const uint8_t *src, int width);
 
     if (ts->ds->depth == 0)
        return;
@@ -208,7 +208,7 @@ static void tcx_update_display(void *opaque)
     case 0:
        return;
     }
-    
+
     for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) {
        if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) {
            if (y_start < 0)
@@ -232,7 +232,7 @@ static void tcx_update_display(void *opaque)
        } else {
             if (y_start >= 0) {
                 /* flush to display */
-                dpy_update(ts->ds, 0, y_start, 
+                dpy_update(ts->ds, 0, y_start,
                            ts->width, y - y_start);
                 y_start = -1;
             }
@@ -242,7 +242,7 @@ static void tcx_update_display(void *opaque)
     }
     if (y_start >= 0) {
        /* flush to display */
-       dpy_update(ts->ds, 0, y_start, 
+       dpy_update(ts->ds, 0, y_start,
                   ts->width, y - y_start);
     }
     /* reset modified pages */
@@ -353,10 +353,7 @@ static void tcx24_invalidate_display(void *opaque)
 static void tcx_save(QEMUFile *f, void *opaque)
 {
     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 void tcx_save(QEMUFile *f, void *opaque)
 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 @@ void tcx_init(DisplayState *ds, target_phys_addr_t addr, uint8_t *vram_base,
     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);