qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 01/16] memory: move endianness compensation to m


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 01/16] memory: move endianness compensation to memory core
Date: Sat, 07 Jan 2012 08:52:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111220 Thunderbird/9.0

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 <address@hidden>

> 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



reply via email to

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