From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: Re: [kvm-ppc-devel] RFC: MMIO endianness flag Date: Mon, 14 Jan 2008 21:54:18 -0600 Message-ID: <1200369258.2215.7.camel@basalt> References: <1199920008.5637.48.camel@basalt> <4785C199.9040002@qumranet.com> <1199978634.20324.10.camel@basalt> <4786398C.2090308@qumranet.com> <1200005864.23377.55.camel@basalt> <4789DD0C.4010600@qumranet.com> <1200329510.29077.11.camel@basalt> <51CFAB8CB6883745AE7B93B3E084EBE2016217AB@pdsmsx412.ccr.corp.intel.com> Reply-To: Hollis Blanchard Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-ppc-devel , kvm-devel , Avi Kivity To: "Xu, Anthony" Return-path: In-Reply-To: <51CFAB8CB6883745AE7B93B3E084EBE2016217AB-wq7ZOvIWXbOiAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org 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 ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace