[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH v2] target-ppc: gdbstub allow byte sw
From: |
Peter Maydell |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH v2] target-ppc: gdbstub allow byte swapping for reading/writing registers |
Date: |
Thu, 16 Jan 2014 17:41:39 +0000 |
On 16 January 2014 16:59, Thomas Falcon <address@hidden> wrote:
> This patch allows registers to be properly read from and written to
> when using the gdbstub to debug a ppc guest running in little
> endian mode. It accomplishes this goal by byte swapping the values of
> any registers if the MSR:LE value is set.
>
> Signed-off-by: Thomas Falcon<address@hidden>
> ---
> Have created wrapper functions that swap mem_buf in-place.
> mem_buf is swapped regardless of the the host's endianness if msr_le is
> true.
> ---
> + int len = ppc_cpu_gdb_read_register(cs, mem_buf, n),i;
> + if(msr_le)
> + {
> + uint8_t tmp;
> + for(i=0;i<len/2;i++)
> + {
> + tmp=*(mem_buf+i);
> + *(mem_buf+i)=*(mem_buf+len-1-i);
> + *(mem_buf+len-1-i)=tmp;
> + }
Please don't roll your own byte swapping.
Also see my remarks on the previous patch series suggesting
that we should look at this in a more holistic way than
just randomly fixing small bits of things. A good place
to start would be "what should the semantics of stl_p()
be for a QEMU where the CPU is currently operating with
a reversed endianness to the TARGET_WORDS_BIGENDIAN
setting?".
thanks
-- PMM