We can now simply use address_space_rw instead of the more convoluted cpu_in() and cpu_out() functions.
Signed-off-by: Hervé Poussineau <hpous...@reactos.org> --- hw/isa/isa_mmio.c | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/hw/isa/isa_mmio.c b/hw/isa/isa_mmio.c index d4dbf13..5bf8878 100644 --- a/hw/isa/isa_mmio.c +++ b/hw/isa/isa_mmio.c @@ -26,44 +26,24 @@ #include "hw/isa/isa.h" #include "exec/address-spaces.h" -static void isa_mmio_writeb (void *opaque, hwaddr addr, - uint32_t val) +static void isa_mmio_write(void *opaque, hwaddr addr, uint64_t data, + unsigned int size) { - cpu_outb(addr & IOPORTS_MASK, val); + addr &= IOPORTS_MASK; + address_space_write(&address_space_io, addr, (uint8_t *)&data, size); } -static void isa_mmio_writew(void *opaque, hwaddr addr, - uint32_t val) +static uint64_t isa_mmio_read(void *opaque, hwaddr addr, unsigned int size) { - cpu_outw(addr & IOPORTS_MASK, val); -} - -static void isa_mmio_writel(void *opaque, hwaddr addr, - uint32_t val) -{ - cpu_outl(addr & IOPORTS_MASK, val); -} - -static uint32_t isa_mmio_readb (void *opaque, hwaddr addr) -{ - return cpu_inb(addr & IOPORTS_MASK); -} - -static uint32_t isa_mmio_readw(void *opaque, hwaddr addr) -{ - return cpu_inw(addr & IOPORTS_MASK); -} - -static uint32_t isa_mmio_readl(void *opaque, hwaddr addr) -{ - return cpu_inl(addr & IOPORTS_MASK); + uint64_t data = 0; + addr &= IOPORTS_MASK; + address_space_read(&address_space_io, addr, (uint8_t *)&data, size); + return data; } static const MemoryRegionOps isa_mmio_ops = { - .old_mmio = { - .write = { isa_mmio_writeb, isa_mmio_writew, isa_mmio_writel }, - .read = { isa_mmio_readb, isa_mmio_readw, isa_mmio_readl, }, - }, + .write = isa_mmio_write, + .read = isa_mmio_read, .endianness = DEVICE_LITTLE_ENDIAN, }; -- 1.7.10.4