From: Hollis B. <ho...@us...> - 2008-01-15 03:54:55
|
On Tue, 2008-01-15 at 10:43 +0800, Xu, Anthony wrote: > > Here is the concrete example: > > * guest writes to MMIO > > * KVM passes MMIO information (physical address, number of > > bytes, value) to qemu > The value is saved in memory, is it bigendian or > littleendian? The value in memory is copied from the value in the register when the guest was executing, so its format is probably dependent on the state of a control register. > > * Qemu knows from the address that this access is for a > > passthough device, a special case the administrator has > > pre-configured * Qemu does mmap(/dev/mem), and writes "length" > > When qemu writes value, Can qemu know what > mode(bigendian/littleendian it is running)? > Qemu can run on bigendian in IA64. /usr/include/endian.h will #define __BYTE_ORDER as either __LITTLE_ENDIAN or __BIG_ENDIAN. I have no idea if this is defined in a standard or is glibc-specific. You could also test at runtime with a construct like: union { int i; char c[4]; } u; u.i = 1; if (u.c[0] == 1) { ... } else { ... } -- Hollis Blanchard IBM Linux Technology Center |