aboutsummaryrefslogtreecommitdiff
path: root/hw/slavio_serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/slavio_serial.c')
-rw-r--r--hw/slavio_serial.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/slavio_serial.c b/hw/slavio_serial.c
index 3da40eb6cf..0a2c873300 100644
--- a/hw/slavio_serial.c
+++ b/hw/slavio_serial.c
@@ -102,6 +102,7 @@ struct SerialState {
};
#define SERIAL_MAXADDR 7
+#define SERIAL_SIZE (SERIAL_MAXADDR + 1)
static void handle_kbd_command(ChannelState *s, int val);
static int serial_can_receive(void *opaque);
@@ -178,7 +179,7 @@ static void slavio_serial_reset_chn(ChannelState *s)
int i;
s->reg = 0;
- for (i = 0; i < SERIAL_MAXADDR; i++) {
+ for (i = 0; i < SERIAL_SIZE; i++) {
s->rregs[i] = 0;
s->wregs[i] = 0;
}
@@ -598,7 +599,7 @@ SerialState *slavio_serial_init(target_phys_addr_t base, qemu_irq irq,
return NULL;
slavio_serial_io_memory = cpu_register_io_memory(0, slavio_serial_mem_read, slavio_serial_mem_write, s);
- cpu_register_physical_memory(base, SERIAL_MAXADDR, slavio_serial_io_memory);
+ cpu_register_physical_memory(base, SERIAL_SIZE, slavio_serial_io_memory);
s->chn[0].chr = chr1;
s->chn[1].chr = chr2;
@@ -723,7 +724,7 @@ void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq)
s->chn[1].type = kbd;
slavio_serial_io_memory = cpu_register_io_memory(0, slavio_serial_mem_read, slavio_serial_mem_write, s);
- cpu_register_physical_memory(base, SERIAL_MAXADDR, slavio_serial_io_memory);
+ cpu_register_physical_memory(base, SERIAL_SIZE, slavio_serial_io_memory);
qemu_add_mouse_event_handler(sunmouse_event, &s->chn[0], 0, "QEMU Sun Mouse");
qemu_add_kbd_event_handler(sunkbd_event, &s->chn[1]);