vga: Declare as little endian

This patch replaces explicit bswaps with endianness hints to the
mmio layer.

CC: Alexander Graf <agraf@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Blue Swirl 2010-12-19 10:04:04 +00:00
parent 5d6b423c5c
commit 6a0ee36a47

View File

@ -767,30 +767,18 @@ uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr)
static uint32_t vga_mem_readw(void *opaque, target_phys_addr_t addr)
{
uint32_t v;
#ifdef TARGET_WORDS_BIGENDIAN
v = vga_mem_readb(opaque, addr) << 8;
v |= vga_mem_readb(opaque, addr + 1);
#else
v = vga_mem_readb(opaque, addr);
v |= vga_mem_readb(opaque, addr + 1) << 8;
#endif
return v;
}
static uint32_t vga_mem_readl(void *opaque, target_phys_addr_t addr)
{
uint32_t v;
#ifdef TARGET_WORDS_BIGENDIAN
v = vga_mem_readb(opaque, addr) << 24;
v |= vga_mem_readb(opaque, addr + 1) << 16;
v |= vga_mem_readb(opaque, addr + 2) << 8;
v |= vga_mem_readb(opaque, addr + 3);
#else
v = vga_mem_readb(opaque, addr);
v |= vga_mem_readb(opaque, addr + 1) << 8;
v |= vga_mem_readb(opaque, addr + 2) << 16;
v |= vga_mem_readb(opaque, addr + 3) << 24;
#endif
return v;
}
@ -931,28 +919,16 @@ void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
static void vga_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t val)
{
#ifdef TARGET_WORDS_BIGENDIAN
vga_mem_writeb(opaque, addr, (val >> 8) & 0xff);
vga_mem_writeb(opaque, addr + 1, val & 0xff);
#else
vga_mem_writeb(opaque, addr, val & 0xff);
vga_mem_writeb(opaque, addr + 1, (val >> 8) & 0xff);
#endif
}
static void vga_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
{
#ifdef TARGET_WORDS_BIGENDIAN
vga_mem_writeb(opaque, addr, (val >> 24) & 0xff);
vga_mem_writeb(opaque, addr + 1, (val >> 16) & 0xff);
vga_mem_writeb(opaque, addr + 2, (val >> 8) & 0xff);
vga_mem_writeb(opaque, addr + 3, val & 0xff);
#else
vga_mem_writeb(opaque, addr, val & 0xff);
vga_mem_writeb(opaque, addr + 1, (val >> 8) & 0xff);
vga_mem_writeb(opaque, addr + 2, (val >> 16) & 0xff);
vga_mem_writeb(opaque, addr + 3, (val >> 24) & 0xff);
#endif
}
typedef void vga_draw_glyph8_func(uint8_t *d, int linesize,
@ -2321,7 +2297,7 @@ void vga_init(VGACommonState *s)
#endif /* CONFIG_BOCHS_VBE */
vga_io_memory = cpu_register_io_memory(vga_mem_read, vga_mem_write, s,
DEVICE_NATIVE_ENDIAN);
DEVICE_LITTLE_ENDIAN);
cpu_register_physical_memory(isa_mem_base + 0x000a0000, 0x20000,
vga_io_memory);
qemu_register_coalesced_mmio(isa_mem_base + 0x000a0000, 0x20000);