From: Paul Mackerras <paulus@samba.org>
To: Tom <tommusta@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [V2 PATCH 2/3] powerpc: Fix Unaligned Fixed Point Loads and Stores
Date: Mon, 4 Nov 2013 13:43:29 +1100 [thread overview]
Message-ID: <20131104024329.GB32010@drongo> (raw)
In-Reply-To: <1383244738-5986-3-git-send-email-tommusta@gmail.com>
On Thu, Oct 31, 2013 at 01:38:57PM -0500, Tom wrote:
> From: Tom Musta <tommusta@gmail.com>
>
> This patch modifies the unaligned access routines of the sstep.c
> module so that it properly reverses the bytes of storage operands
> in the little endian kernel kernel.
This has rather a lot of #ifdefs inside function definitions, and for
little-endian it does the unaligned accesses one byte at a time. You
could avoid all the #ifdefs if you define the combining function in an
endian-dependant way and make read_mem_unaligned look something like
this:
#ifdef __LITTLE_ENDIAN__
#define combine_pieces(x, b, c, nd) ((x) + ((b) << (8 * (nd))))
#else
#define combine_pieces(x, b, c, nd) (((x) << (8 * (c))) + (b))
#endif
static int __kprobes read_mem_unaligned(unsigned long *dest, unsigned long ea,
int nb, struct pt_regs *regs)
{
int err;
int nd;
unsigned long x, b, c;
/* unaligned, do this in pieces */
x = 0;
for (nd = 0; nd < nb; nd += c) {
c = max_align(ea);
if (c > nb - nd)
c = max_align(nb - nd);
err = read_mem_aligned(&b, ea, c);
if (err)
return err;
x = combine_pieces(x, b, c, nd);
ea += c;
}
*dest = x;
return 0;
}
and do something analogous for write_mem_unaligned().
Paul.
next prev parent reply other threads:[~2013-11-04 2:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 18:38 [V2 PATCH 0/3] powerpc: Fix Little Endian Bugs in Single Step Code Tom
2013-10-31 18:38 ` [V2 PATCH 1/3] powerpc: Enable emulate_step In Little Endian Mode Tom
2013-11-04 2:28 ` Paul Mackerras
2013-10-31 18:38 ` [V2 PATCH 2/3] powerpc: Fix Unaligned Fixed Point Loads and Stores Tom
2013-11-04 2:34 ` Benjamin Herrenschmidt
2013-11-04 2:43 ` Paul Mackerras [this message]
2013-10-31 18:38 ` [V2 PATCH 3/3] powerpc: Fix Unaligned LE Floating " Tom
2013-11-04 2:34 ` Benjamin Herrenschmidt
2013-11-04 13:29 ` Tom Musta
2013-12-11 3:54 ` Paul Mackerras
2013-12-11 4:57 ` Paul Mackerras
2013-12-12 15:08 ` Tom Musta
2013-12-12 20:33 ` Tom Musta
2013-12-12 21:19 ` Paul Mackerras
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=20131104024329.GB32010@drongo \
--to=paulus@samba.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=tommusta@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.