X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdevices%2Fpci.c;h=cb368e1244b67d86d2a2d003f8667e100f49be30;hb=474dd860a3b9911e790eb4a199a50bbac525dd1e;hp=2df8e2ae4022c8c203a3b2cfcbe5d5c13bf96e9d;hpb=2e1ad312883a5ba610d02d039fe183283d4d4667;p=pintos-anon 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) {