Big endian byte swap for serial mmapped interface.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2946 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
afcc3cdfc4
commit
e918ee04e9
22
hw/serial.c
22
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user