From patchwork Wed Dec 29 21:27:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 76947 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 CC385B6F1E for ; Thu, 30 Dec 2010 08:29:16 +1100 (EST) Received: from localhost ([127.0.0.1]:50663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PY3a5-0000XX-0z for incoming@patchwork.ozlabs.org; Wed, 29 Dec 2010 16:29:13 -0500 Received: from [140.186.70.92] (port=34894 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PY3YN-0008QF-DG for qemu-devel@nongnu.org; Wed, 29 Dec 2010 16:27:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PY3YM-0006Kh-5a for qemu-devel@nongnu.org; Wed, 29 Dec 2010 16:27:27 -0500 Received: from hall.aurel32.net ([88.191.126.93]:60172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PY3YL-0006Jy-Uz for qemu-devel@nongnu.org; Wed, 29 Dec 2010 16:27:26 -0500 Received: from farad.aurel32.net ([82.232.2.251] helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PY3YC-0007CQ-DO; Wed, 29 Dec 2010 22:27:16 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.72) (envelope-from ) id 1PY3YB-0002f2-BP; Wed, 29 Dec 2010 22:27:15 +0100 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Wed, 29 Dec 2010 22:27:09 +0100 Message-Id: <1293658029-10184-1-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 1.7.2.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Aurelien Jarno Subject: [Qemu-devel] [PATCH] Fix curses on big endian hosts 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 On big endian hosts, the curses interface is unusable: the emulated graphic card only displays garbage, while the monitor interface displays nothing (or rather only spaces). The curses interface is waiting for data in native endianness, so console_write_ch() should not do any conversion. The conversion should be done when reading the video buffer in hw/vga.c. I supposed this buffer is in little endian mode, though it's not impossible that the data is actually in guest endianness. I currently have no big endian guest to way (they all switch to graphic mode immediately). Signed-off-by: Aurelien Jarno --- console.h | 2 +- hw/vga.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/console.h b/console.h index b2fc908..3157330 100644 --- a/console.h +++ b/console.h @@ -329,7 +329,7 @@ static inline void console_write_ch(console_ch_t *dest, uint32_t ch) { if (!(ch & 0xff)) ch |= ' '; - cpu_to_le32wu((uint32_t *) dest, ch); + *dest = ch; } typedef void (*vga_hw_update_ptr)(void *); diff --git a/hw/vga.c b/hw/vga.c index c632fd7..e2151a2 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -2073,14 +2073,14 @@ static void vga_update_text(void *opaque, console_ch_t *chardata) if (full_update) { for (i = 0; i < size; src ++, dst ++, i ++) - console_write_ch(dst, VMEM2CHTYPE(*src)); + console_write_ch(dst, VMEM2CHTYPE(le32_to_cpu(*src))); dpy_update(s->ds, 0, 0, width, height); } else { c_max = 0; for (i = 0; i < size; src ++, dst ++, i ++) { - console_write_ch(&val, VMEM2CHTYPE(*src)); + console_write_ch(&val, VMEM2CHTYPE(le32_to_cpu(*src))); if (*dst != val) { *dst = val; c_max = i; @@ -2089,7 +2089,7 @@ static void vga_update_text(void *opaque, console_ch_t *chardata) } c_min = i; for (; i < size; src ++, dst ++, i ++) { - console_write_ch(&val, VMEM2CHTYPE(*src)); + console_write_ch(&val, VMEM2CHTYPE(le32_to_cpu(*src))); if (*dst != val) { *dst = val; c_max = i;