qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qtest: add read/write accessors with a specific


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] qtest: add read/write accessors with a specific endianness
Date: Wed, 5 Oct 2016 10:32:53 -0700

On 5 October 2016 at 10:17, Cédric Le Goater <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]