From patchwork Sat Dec 11 22:33:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 75213 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 65AEDB708B for ; Sun, 12 Dec 2010 09:34:33 +1100 (EST) Received: from localhost ([127.0.0.1]:59321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRY1O-0006Ec-P7 for incoming@patchwork.ozlabs.org; Sat, 11 Dec 2010 17:34:30 -0500 Received: from [140.186.70.92] (port=56985 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRY0v-0006EN-3Z for qemu-devel@nongnu.org; Sat, 11 Dec 2010 17:34:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PRY0t-0004oA-AH for qemu-devel@nongnu.org; Sat, 11 Dec 2010 17:34:01 -0500 Received: from mail-pv0-f195.google.com ([74.125.83.195]:41798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PRY0t-0004o5-2r for qemu-devel@nongnu.org; Sat, 11 Dec 2010 17:33:59 -0500 Received: by pvb32 with SMTP id 32so840876pvb.10 for ; Sat, 11 Dec 2010 14:33:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=ABUWx7ZkyCdizrn3RwX/91HmVKa6GyPENaNrzWtcFo4=; b=sC2f0qpaZG06HsFYtv/oZnN7fXoE6CB8EPyp5LA6isTP+zl5EJZ3XvrKPl2avgeCpN kytDdzT8R849Kav+ZjFiYA3Fj9mMNg8/fmA8RpXswr+kzXXOPE6dfkxfg9Q2x94HtnjR I8EALLyasaAIxbTpfDlXGSOD1N9bXPQqxr+XQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=StfptsHO16V0ETZjNrh+50t45bN03Hbe75SP6E1hVLvaeSo2fwSWMwTcWJxKrTNTlB f8ibNq+GKpppOAShOcMZaUweJpM5k1Bj6rM4tzsqgkJLDOPrAgBvpmcxhsC5ZOnC84tI QHg1Bgc47Rex3xNF8Kdbi9AvCcTU/dA7JWIlc= Received: by 10.142.225.19 with SMTP id x19mr1730882wfg.5.1292106838046; Sat, 11 Dec 2010 14:33:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.135.1 with HTTP; Sat, 11 Dec 2010 14:33:37 -0800 (PST) From: Blue Swirl Date: Sat, 11 Dec 2010 22:33:37 +0000 Message-ID: To: qemu-devel , Alexander Graf X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Subject: [Qemu-devel] [PATCH] vga: Declare as little endian X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch replaces explicit bswaps with endianness hints to the mmio layer. CC: Alexander Graf Signed-off-by: Blue Swirl Acked-by: Alexander Graf --- hw/vga.c | 26 +------------------------- 1 files changed, 1 insertions(+), 25 deletions(-) @@ -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); 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; }