mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
pc-testdev: support 8 and 16-bit accesses to 0xe0
This will let us use the testdev to test endianness. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1374501278-31549-17-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
f36a6382b8
commit
b7faba7163
1 changed files with 9 additions and 2 deletions
|
@ -80,13 +80,20 @@ static void test_ioport_write(void *opaque, hwaddr addr, uint64_t data,
|
||||||
unsigned len)
|
unsigned len)
|
||||||
{
|
{
|
||||||
PCTestdev *dev = opaque;
|
PCTestdev *dev = opaque;
|
||||||
dev->ioport_data = data;
|
int bits = len * 8;
|
||||||
|
int start_bit = (addr & 3) * 8;
|
||||||
|
uint32_t mask = ((uint32_t)-1 >> (32 - bits)) << start_bit;
|
||||||
|
dev->ioport_data &= ~mask;
|
||||||
|
dev->ioport_data |= data << start_bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t test_ioport_read(void *opaque, hwaddr addr, unsigned len)
|
static uint64_t test_ioport_read(void *opaque, hwaddr addr, unsigned len)
|
||||||
{
|
{
|
||||||
PCTestdev *dev = opaque;
|
PCTestdev *dev = opaque;
|
||||||
return dev->ioport_data;
|
int bits = len * 8;
|
||||||
|
int start_bit = (addr & 3) * 8;
|
||||||
|
uint32_t mask = ((uint32_t)-1 >> (32 - bits)) << start_bit;
|
||||||
|
return (dev->ioport_data & mask) >> start_bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const MemoryRegionOps test_ioport_ops = {
|
static const MemoryRegionOps test_ioport_ops = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue