qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [Qemu-devel] [PATCH v4] target-ppc: gdbstub allow byte sw


From: Richard Henderson
Subject: Re: [Qemu-ppc] [Qemu-devel] [PATCH v4] target-ppc: gdbstub allow byte swapping for reading/writing registers
Date: Fri, 28 Feb 2014 09:37:50 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 02/26/2014 02:51 PM, Thomas Falcon wrote:
> +void ppc_cpu_gdb_swap_register(uint8_t *mem_buf, int n)
> +{
> +    int len = ppc_cpu_gdb_register_len(n);
> +    int i = 0;
> +    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;
> +    }
> +}

Ew.

The number of register sizes you need to handle is extremely limited.  One can
easily use bswap32 and bswap64 for this.


r~



reply via email to

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