Commit e918ee04 authored by ths's avatar ths
Browse files

Big endian byte swap for serial mmapped interface.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2946 c046a42c-6fe2-441c-8c8c-71466251a162
parent afcc3cdf
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment