mirror of https://github.com/xemu-project/xemu.git
armv7m: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
e219dea2f3
commit
f69bf9d41c
24
hw/armv7m.c
24
hw/armv7m.c
|
@ -106,31 +106,27 @@ static void bitband_writel(void *opaque, target_phys_addr_t offset,
|
||||||
cpu_physical_memory_write(addr, (uint8_t *)&v, 4);
|
cpu_physical_memory_write(addr, (uint8_t *)&v, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUReadMemoryFunc * const bitband_readfn[] = {
|
static const MemoryRegionOps bitband_ops = {
|
||||||
bitband_readb,
|
.old_mmio = {
|
||||||
bitband_readw,
|
.read = { bitband_readb, bitband_readw, bitband_readl, },
|
||||||
bitband_readl
|
.write = { bitband_writeb, bitband_writew, bitband_writel, },
|
||||||
};
|
},
|
||||||
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
static CPUWriteMemoryFunc * const bitband_writefn[] = {
|
|
||||||
bitband_writeb,
|
|
||||||
bitband_writew,
|
|
||||||
bitband_writel
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SysBusDevice busdev;
|
SysBusDevice busdev;
|
||||||
|
MemoryRegion iomem;
|
||||||
uint32_t base;
|
uint32_t base;
|
||||||
} BitBandState;
|
} BitBandState;
|
||||||
|
|
||||||
static int bitband_init(SysBusDevice *dev)
|
static int bitband_init(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
BitBandState *s = FROM_SYSBUS(BitBandState, dev);
|
BitBandState *s = FROM_SYSBUS(BitBandState, dev);
|
||||||
int iomemtype;
|
|
||||||
|
|
||||||
iomemtype = cpu_register_io_memory(bitband_readfn, bitband_writefn,
|
memory_region_init_io(&s->iomem, &bitband_ops, &s->base, "bitband",
|
||||||
&s->base, DEVICE_NATIVE_ENDIAN);
|
0x02000000);
|
||||||
sysbus_init_mmio(dev, 0x02000000, iomemtype);
|
sysbus_init_mmio_region(dev, &s->iomem);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue