]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
use constant IOPORTS_MASK instead of 0xffff.
authorIsaku Yamahata <yamahata@valinux.co.jp>
Thu, 2 Jul 2009 10:32:07 +0000 (19:32 +0900)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 9 Jul 2009 21:06:39 +0000 (16:06 -0500)
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/apb_pci.c
hw/isa_mmio.c
ioport.c
ioport.h
monitor.c

index 5c8ffee4b2e50ab3b5053f73f021dee6d6937bd5..5f411aa02cfc80a4322f6833d7c183351c77cfb6 100644 (file)
@@ -148,26 +148,26 @@ static CPUReadMemoryFunc *pci_apb_read[] = {
 static void pci_apb_iowriteb (void *opaque, target_phys_addr_t addr,
                                   uint32_t val)
 {
-    cpu_outb(NULL, addr & 0xffff, val);
+    cpu_outb(NULL, addr & IOPORTS_MASK, val);
 }
 
 static void pci_apb_iowritew (void *opaque, target_phys_addr_t addr,
                                   uint32_t val)
 {
-    cpu_outw(NULL, addr & 0xffff, val);
+    cpu_outw(NULL, addr & IOPORTS_MASK, val);
 }
 
 static void pci_apb_iowritel (void *opaque, target_phys_addr_t addr,
                                 uint32_t val)
 {
-    cpu_outl(NULL, addr & 0xffff, val);
+    cpu_outl(NULL, addr & IOPORTS_MASK, val);
 }
 
 static uint32_t pci_apb_ioreadb (void *opaque, target_phys_addr_t addr)
 {
     uint32_t val;
 
-    val = cpu_inb(NULL, addr & 0xffff);
+    val = cpu_inb(NULL, addr & IOPORTS_MASK);
     return val;
 }
 
@@ -175,7 +175,7 @@ static uint32_t pci_apb_ioreadw (void *opaque, target_phys_addr_t addr)
 {
     uint32_t val;
 
-    val = cpu_inw(NULL, addr & 0xffff);
+    val = cpu_inw(NULL, addr & IOPORTS_MASK);
     return val;
 }
 
@@ -183,7 +183,7 @@ static uint32_t pci_apb_ioreadl (void *opaque, target_phys_addr_t addr)
 {
     uint32_t val;
 
-    val = cpu_inl(NULL, addr & 0xffff);
+    val = cpu_inl(NULL, addr & IOPORTS_MASK);
     return val;
 }
 
index 1d5e8dc34f92d95097ba00c3e2c4b04f2ced1a81..868c7b0ccab264fc8e8586c32c1c01ac473e3079 100644 (file)
@@ -28,7 +28,7 @@
 static void isa_mmio_writeb (void *opaque, target_phys_addr_t addr,
                                   uint32_t val)
 {
-    cpu_outb(NULL, addr & 0xffff, val);
+    cpu_outb(NULL, addr & IOPORTS_MASK, val);
 }
 
 static void isa_mmio_writew (void *opaque, target_phys_addr_t addr,
@@ -37,7 +37,7 @@ static void isa_mmio_writew (void *opaque, target_phys_addr_t addr,
 #ifdef TARGET_WORDS_BIGENDIAN
     val = bswap16(val);
 #endif
-    cpu_outw(NULL, addr & 0xffff, val);
+    cpu_outw(NULL, addr & IOPORTS_MASK, val);
 }
 
 static void isa_mmio_writel (void *opaque, target_phys_addr_t addr,
@@ -46,14 +46,14 @@ static void isa_mmio_writel (void *opaque, target_phys_addr_t addr,
 #ifdef TARGET_WORDS_BIGENDIAN
     val = bswap32(val);
 #endif
-    cpu_outl(NULL, addr & 0xffff, val);
+    cpu_outl(NULL, addr & IOPORTS_MASK, val);
 }
 
 static uint32_t isa_mmio_readb (void *opaque, target_phys_addr_t addr)
 {
     uint32_t val;
 
-    val = cpu_inb(NULL, addr & 0xffff);
+    val = cpu_inb(NULL, addr & IOPORTS_MASK);
     return val;
 }
 
@@ -61,7 +61,7 @@ static uint32_t isa_mmio_readw (void *opaque, target_phys_addr_t addr)
 {
     uint32_t val;
 
-    val = cpu_inw(NULL, addr & 0xffff);
+    val = cpu_inw(NULL, addr & IOPORTS_MASK);
 #ifdef TARGET_WORDS_BIGENDIAN
     val = bswap16(val);
 #endif
@@ -72,7 +72,7 @@ static uint32_t isa_mmio_readl (void *opaque, target_phys_addr_t addr)
 {
     uint32_t val;
 
-    val = cpu_inl(NULL, addr & 0xffff);
+    val = cpu_inl(NULL, addr & IOPORTS_MASK);
 #ifdef TARGET_WORDS_BIGENDIAN
     val = bswap32(val);
 #endif
index d875209115160629847adcbe89280fe9a2992f42..04bffc4cbc5be950fe7d077aef4d978a2fe01a27 100644 (file)
--- a/ioport.c
+++ b/ioport.c
@@ -94,7 +94,7 @@ static uint32_t default_ioport_readw(void *opaque, uint32_t address)
 {
     uint32_t data;
     data = ioport_read(0, address);
-    address = (address + 1) & (MAX_IOPORTS - 1);
+    address = (address + 1) & IOPORTS_MASK;
     data |= ioport_read(0, address) << 8;
     return data;
 }
@@ -102,7 +102,7 @@ static uint32_t default_ioport_readw(void *opaque, uint32_t address)
 static void default_ioport_writew(void *opaque, uint32_t address, uint32_t data)
 {
     ioport_write(0, address, data & 0xff);
-    address = (address + 1) & (MAX_IOPORTS - 1);
+    address = (address + 1) & IOPORTS_MASK;
     ioport_write(0, address, (data >> 8) & 0xff);
 }
 
index 309a402f86ecea89f36aa5c34b54dbbbc4f57fad..4cb59e951f3cd3027086cfe6c8ea6ad06418e6a4 100644 (file)
--- a/ioport.h
+++ b/ioport.h
@@ -28,6 +28,7 @@
 #include "qemu-common.h"
 
 #define MAX_IOPORTS     (64 * 1024)
+#define IOPORTS_MASK    (MAX_IOPORTS - 1)
 
 /* These should really be in isa.h, but are here to make pc.h happy.  */
 typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
index 301bde0736f16484e0320421f43b5086e146451e..342af32326e5d972e786f7f59edf9a2bdfe542a4 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -1161,7 +1161,7 @@ static void do_ioport_read(Monitor *mon, int count, int format, int size,
     int suffix;
 
     if (has_index) {
-        cpu_outb(NULL, addr & 0xffff, index & 0xff);
+        cpu_outb(NULL, addr & IOPORTS_MASK, index & 0xff);
         addr++;
     }
     addr &= 0xffff;