qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] lsi53c895a: fix endianness issues


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] lsi53c895a: fix endianness issues
Date: Fri, 7 Jan 2011 16:21:29 +0000

On Fri, Jan 7, 2011 at 2:43 PM,  <address@hidden> wrote:
> From: Aurelien Jarno <address@hidden>
>
> lsi_ram_read*() and lsi_ram_write*() are not consistent, one uses
> leXX_to_cpu() the other uses nothing. As the comment above the RAM
> declaration says: "Script ram is stored as 32-bit words in host
> byteorder.", remove the leXX_to_cpu() calls.
>
> This fixes the boot of an ARM versatile machine on MIPS and PowerPC
> hosts.
>
> Signed-off-by: Aurelien Jarno <address@hidden>
> ---
>  hw/lsi53c895a.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

script_ram[] is host byteorder for sure.  This patch looks correct.

Now I'm wondering about read_dword:

static inline uint32_t read_dword(LSIState *s, uint32_t addr)
{
    uint32_t buf;

    /* Optimize reading from SCRIPTS RAM.  */
    if ((addr & 0xffffe000) == s->script_ram_base) {
        return s->script_ram[(addr & 0x1fff) >> 2];
    }
    cpu_physical_memory_read(addr, (uint8_t *)&buf, 4);
    return cpu_to_le32(buf);
}

If addr is in script_ram[], then the return value is host byteorder.

If addr is not in script_ram[], then it is converted to little-endian?
 Will lsi emulation work on big-endian hosts?

Stefan



reply via email to

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