OSDN Git Service

faster I/Os - default 16 bit I/O fix
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Wed, 12 May 2004 19:50:26 +0000 (19:50 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Wed, 12 May 2004 19:50:26 +0000 (19:50 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@801 c046a42c-6fe2-441c-8c8c-71466251a162

vl.c

diff --git a/vl.c b/vl.c
index 4489056..807215e 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -147,15 +147,17 @@ void default_ioport_writeb(void *opaque, uint32_t address, uint32_t data)
 uint32_t default_ioport_readw(void *opaque, uint32_t address)
 {
     uint32_t data;
-    data = ioport_read_table[0][address & (MAX_IOPORTS - 1)](opaque, address);
-    data |= ioport_read_table[0][(address + 1) & (MAX_IOPORTS - 1)](opaque, address + 1) << 8;
+    data = ioport_read_table[0][address](ioport_opaque[address], address);
+    address = (address + 1) & (MAX_IOPORTS - 1);
+    data |= ioport_read_table[0][address](ioport_opaque[address], address) << 8;
     return data;
 }
 
 void default_ioport_writew(void *opaque, uint32_t address, uint32_t data)
 {
-    ioport_write_table[0][address & (MAX_IOPORTS - 1)](opaque, address, data & 0xff);
-    ioport_write_table[0][(address + 1) & (MAX_IOPORTS - 1)](opaque, address + 1, (data >> 8) & 0xff);
+    ioport_write_table[0][address](ioport_opaque[address], address, data & 0xff);
+    address = (address + 1) & (MAX_IOPORTS - 1);
+    ioport_write_table[0][address](ioport_opaque[address], address, (data >> 8) & 0xff);
 }
 
 uint32_t default_ioport_readl(void *opaque, uint32_t address)
@@ -283,7 +285,6 @@ int load_image(const char *filename, uint8_t *addr)
 
 void cpu_outb(CPUState *env, int addr, int val)
 {
-    addr &= (MAX_IOPORTS - 1);
 #ifdef DEBUG_IOPORT
     if (loglevel & CPU_LOG_IOPORT)
         fprintf(logfile, "outb: %04x %02x\n", addr, val);
@@ -293,7 +294,6 @@ void cpu_outb(CPUState *env, int addr, int val)
 
 void cpu_outw(CPUState *env, int addr, int val)
 {
-    addr &= (MAX_IOPORTS - 1);
 #ifdef DEBUG_IOPORT
     if (loglevel & CPU_LOG_IOPORT)
         fprintf(logfile, "outw: %04x %04x\n", addr, val);
@@ -303,7 +303,6 @@ void cpu_outw(CPUState *env, int addr, int val)
 
 void cpu_outl(CPUState *env, int addr, int val)
 {
-    addr &= (MAX_IOPORTS - 1);
 #ifdef DEBUG_IOPORT
     if (loglevel & CPU_LOG_IOPORT)
         fprintf(logfile, "outl: %04x %08x\n", addr, val);
@@ -314,7 +313,6 @@ void cpu_outl(CPUState *env, int addr, int val)
 int cpu_inb(CPUState *env, int addr)
 {
     int val;
-    addr &= (MAX_IOPORTS - 1);
     val = ioport_read_table[0][addr](ioport_opaque[addr], addr);
 #ifdef DEBUG_IOPORT
     if (loglevel & CPU_LOG_IOPORT)
@@ -326,7 +324,6 @@ int cpu_inb(CPUState *env, int addr)
 int cpu_inw(CPUState *env, int addr)
 {
     int val;
-    addr &= (MAX_IOPORTS - 1);
     val = ioport_read_table[1][addr](ioport_opaque[addr], addr);
 #ifdef DEBUG_IOPORT
     if (loglevel & CPU_LOG_IOPORT)
@@ -338,7 +335,6 @@ int cpu_inw(CPUState *env, int addr)
 int cpu_inl(CPUState *env, int addr)
 {
     int val;
-    addr &= (MAX_IOPORTS - 1);
     val = ioport_read_table[2][addr](ioport_opaque[addr], addr);
 #ifdef DEBUG_IOPORT
     if (loglevel & CPU_LOG_IOPORT)