Am 02.01.2012 17:33, schrieb Avi Kivity: > Instead of doing device endianness compensation in cpu_register_io_memory(), > do it in the memory core. > > Signed-off-by: Avi Kivity <a...@redhat.com>
> diff --git a/exec.c b/exec.c > index 28c057c..507d37c 100644 > --- a/exec.c > +++ b/exec.c > @@ -3666,30 +3565,14 @@ static int cpu_register_io_memory_fixed(int io_index, > } > io_mem_opaque[io_index] = opaque; > > - switch (endian) { > - case DEVICE_BIG_ENDIAN: > -#ifndef TARGET_WORDS_BIGENDIAN > - swapendian_init(io_index); > -#endif > - break; > - case DEVICE_LITTLE_ENDIAN: > -#ifdef TARGET_WORDS_BIGENDIAN > - swapendian_init(io_index); > -#endif > - break; > - case DEVICE_NATIVE_ENDIAN: > - default: > - break; > - } > - > return (io_index << IO_MEM_SHIFT); > } > diff --git a/memory.c b/memory.c > index 868ffd0..6f9fea1 100644 > --- a/memory.c > +++ b/memory.c > @@ -857,6 +857,15 @@ static void > memory_region_destructor_rom_device(MemoryRegion *mr) > cpu_unregister_io_memory(mr->ram_addr & ~(TARGET_PAGE_MASK | > IO_MEM_ROMD)); > } > > +static bool memory_region_wrong_endianness(MemoryRegion *mr) > +{ > +#ifdef TARGET_BIG_ENDIAN This should've been TARGET_WORDS_BIGENDIAN. Patch coming up. Andreas > + return mr->ops->endianness == DEVICE_LITTLE_ENDIAN; > +#else > + return mr->ops->endianness == DEVICE_BIG_ENDIAN; > +#endif > +} -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg