From 474dd860a3b9911e790eb4a199a50bbac525dd1e Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@cs.stanford.edu>
Date: Thu, 11 Dec 2008 21:06:13 -0800
Subject: [PATCH] fix-iomem-arithmetic.patch (applied cleanly)

---
 src/devices/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/devices/pci.c b/src/devices/pci.c
index 2df8e2a..cb368e1 100644
--- a/src/devices/pci.c
+++ b/src/devices/pci.c
@@ -329,7 +329,7 @@ pci_reg_write8 (struct pci_io *pio, int reg, uint8_t data)
 
   if (pio->type == PCI_IO_MEM)
     {
-      ((uint8_t *) pio->addr.ptr)[reg] = data;
+      *((uint8_t *) (pio->addr.ptr + reg)) = data;
     }
   else if (pio->type == PCI_IO_PORT)
     {
@@ -349,7 +349,7 @@ pci_reg_read32 (struct pci_io *pio, int reg)
 
   if (pio->type == PCI_IO_MEM)
     {
-      ret = ((uint32_t *) pio->addr.ptr)[reg];
+      ret = *((uint32_t *) (pio->addr.ptr + reg));
     }
   else if (pio->type == PCI_IO_PORT)
     {
@@ -372,7 +372,7 @@ pci_reg_read16 (struct pci_io * pio, int reg)
   ret = 0;
   if (pio->type == PCI_IO_MEM)
     {
-      ret = ((uint16_t *) pio->addr.ptr)[reg];
+      ret = *((uint16_t *) (pio->addr.ptr + reg));
     }
   else if (pio->type == PCI_IO_PORT)
     {
@@ -395,7 +395,7 @@ pci_reg_read8 (struct pci_io * pio, int reg)
 
   if (pio->type == PCI_IO_MEM)
     {
-      ret = ((uint8_t *) pio->addr.ptr)[reg];
+      ret = *((uint8_t *) (pio->addr.ptr + reg));
     }
   else if (pio->type == PCI_IO_PORT)
     {
-- 
2.30.2