qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH v4] target-ppc: gdbstub allow byte swapping for reading/writing registers
Date: Fri, 28 Feb 2014 09:37:50 -0800	[thread overview]
Message-ID: <5310C96E.8040002@twiddle.net> (raw)
In-Reply-To: <1393455099-4831-1-git-send-email-tlfalcon@linux.vnet.ibm.com>

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	other threads:[~2014-02-28 17:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 22:51 [Qemu-devel] [PATCH v4] target-ppc: gdbstub allow byte swapping for reading/writing registers Thomas Falcon
2014-02-28 17:37 ` Richard Henderson [this message]
2014-02-28 19:28   ` [Qemu-devel] [Qemu-ppc] " Thomas Falcon
2014-02-28 20:08     ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5310C96E.8040002@twiddle.net \
    --to=rth@twiddle.net \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=tlfalcon@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).