qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] target-ppc: gdbstub allow byte swapping for


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH v2] target-ppc: gdbstub allow byte swapping for reading/writing registers
Date: Thu, 16 Jan 2014 18:51:29 +0100


> Am 16.01.2014 um 18:41 schrieb Peter Maydell <address@hidden>:
> 
>> 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?".

That'd open a giant can of worms that I'd rather not open. RTAS for example is 
still BE regardless of guest endianness.


Alex

> 
> thanks
> -- PMM



reply via email to

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