diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-06-06 16:28:07 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-06-06 16:28:07 +0000 |
commit | e918ee04e96dd2d8809cf9d78c14a4d900001211 (patch) | |
tree | 3b0b63d45fb9549bf12395d745172172c37e63b8 /hw | |
parent | afcc3cdfc4f6291ae6cb803339c794029bf6c99a (diff) |
Big endian byte swap for serial mmapped interface.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2946 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r-- | hw/serial.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/hw/serial.c b/hw/serial.c index e0ff3a72c0..088886258e 100644 --- a/hw/serial.c +++ b/hw/serial.c @@ -384,30 +384,44 @@ void serial_mm_writeb (void *opaque, uint32_t serial_mm_readw (void *opaque, target_phys_addr_t addr) { SerialState *s = opaque; + uint32_t val; - return serial_ioport_read(s, (addr - s->base) >> s->it_shift) & 0xFFFF; + val = serial_ioport_read(s, (addr - s->base) >> s->it_shift) & 0xFFFF; +#ifdef TARGET_WORDS_BIGENDIAN + val = bswap16(val); +#endif + return val; } void serial_mm_writew (void *opaque, target_phys_addr_t addr, uint32_t value) { SerialState *s = opaque; - +#ifdef TARGET_WORDS_BIGENDIAN + value = bswap16(value); +#endif serial_ioport_write(s, (addr - s->base) >> s->it_shift, value & 0xFFFF); } uint32_t serial_mm_readl (void *opaque, target_phys_addr_t addr) { SerialState *s = opaque; + uint32_t val; - return serial_ioport_read(s, (addr - s->base) >> s->it_shift); + val = serial_ioport_read(s, (addr - s->base) >> s->it_shift); +#ifdef TARGET_WORDS_BIGENDIAN + val = bswap32(val); +#endif + return val; } void serial_mm_writel (void *opaque, target_phys_addr_t addr, uint32_t value) { SerialState *s = opaque; - +#ifdef TARGET_WORDS_BIGENDIAN + value = bswap32(value); +#endif serial_ioport_write(s, (addr - s->base) >> s->it_shift, value); } |