From 6a0ee36a47f5b0d090316fe10ceada83136338da Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sun, 19 Dec 2010 10:04:04 +0000 Subject: [PATCH] vga: Declare as little endian This patch replaces explicit bswaps with endianness hints to the mmio layer. CC: Alexander Graf Acked-by: Alexander Graf Signed-off-by: Blue Swirl --- hw/vga.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/hw/vga.c b/hw/vga.c index b5c8741..c632fd7 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -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); -- 2.7.4