On 04/07/2015 23:19, Michael S. Tsirkin wrote:
> The fact that address_space_write/_read actually does a byteswap if
> host!=target endian should probably be documented.

FWIW, it's not if host != target endian.  It's if memory region
endianness != target endianness.  See memory_region_wrong_endianness.

> Or maybe it should be changed: it seems likely that non-target-specific 
> devices
> that use it do this incorrectly ATM. In particular, dma_memory_rw_relaxed 
> calls
> address_space_rw and since DMA originates with devices I think there's very
> little chance that these actually want a different behaviour depending on the
> target endian-ness.
> 
> Most likely, these only work correctly because DMA outside RAM
> is highly unusual.

They work correctly because of that, and because most devices *and*
targets are little endian so you have no swap.  On ppc64, which has
TARGET_WORDS_BIGENDIAN, it probably wouldn't work correctly.

Paolo

Reply via email to