On 5 October 2016 at 10:17, Cédric Le Goater <c...@kaod.org> wrote:
> OK. I think my brain is starting to see things from the right
> angle.
>
> Let's try that : my test is simulating a Little Endian CPU which
> is writing a Big Endian value, so it *always* needs to bswap()
> that value.

Yes. If your code on the (LE) guest CPU would be
 "bswap 32-bit value X; store 32-bit value to address"
then your code in the test should be:
 "bswap 32-bit value X; store 32-bit value to address"
If your code on the guest CPU is just
 "write 32-bit value X to address"
then the code in the test is just
 "write 32-bit value X to address"

> cpu_to_be32 is incorrect as it implies the endianness
> of the host which can be wrong (when running BE).

The main time you might want it in a test is if you
do what the IDE and e1000e tests do: build up a
data structure locally, and then memwrite() it to
the guest memory as a pile of bytes (which you then
point the device-under-test at).

thanks
-- PMM

Reply via email to