From: Ben Pfaff Date: Fri, 12 Dec 2008 05:06:13 +0000 (-0800) Subject: fix-iomem-arithmetic.patch (applied cleanly) X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=commitdiff_plain;h=474dd860a3b9911e790eb4a199a50bbac525dd1e fix-iomem-arithmetic.patch (applied cleanly) --- 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) {