From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PATCH] Fix console_write_ch on 64-bit big-endian hosts
Date: Wed, 2 Jun 2010 13:58:53 -0500 [thread overview]
Message-ID: <1275505133-3734-1-git-send-email-aliguori@us.ibm.com> (raw)
Currently, console_ch_t is defined as an unsigned long. However, immediately
after it's definition, we treat it as a uint32_t *. This will work on a little
endian system because of the way bits are layed out but will fail miserably
on big endian hosts.
This patch fixes the code to do the correct thing. This addresses
https://bugs.launchpad.net/qemu/+bug/568614
Reported-by: Devin J. Pohly
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/console.h b/console.h
index cac959f..ddd1bbf 100644
--- a/console.h
+++ b/console.h
@@ -326,9 +326,11 @@ static inline int ds_get_bytes_per_pixel(DisplayState *ds)
typedef unsigned long console_ch_t;
static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
{
+ uint32_t p;
if (!(ch & 0xff))
ch |= ' ';
- cpu_to_le32wu((uint32_t *) dest, ch);
+ cpu_to_le32wu(&p, ch);
+ *dest = p;
}
typedef void (*vga_hw_update_ptr)(void *);
--
1.7.0.4
next reply other threads:[~2010-06-02 18:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-02 18:58 Anthony Liguori [this message]
2010-06-02 19:31 ` [Qemu-devel] [PATCH] Fix console_write_ch on 64-bit big-endian hosts andrzej zaborowski
2010-06-02 20:32 ` Anthony Liguori
2010-06-02 20:58 ` andrzej zaborowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1275505133-3734-1-git-send-email-aliguori@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).