From: Chris Smart <chris@distroguy.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: Re: [Patch v2 1/2] powerpc: Send SIGBUS on unaligned copy and paste
Date: Tue, 21 Jun 2016 10:39:10 +1000 [thread overview]
Message-ID: <20160621003909.GA11166@distroguy.com> (raw)
In-Reply-To: <20160617040412.GC25170@gate.crashing.org>
On Thu, Jun 16, 2016 at 11:04:12PM -0500, Segher Boessenkool wrote:
>On Fri, Jun 17, 2016 at 09:33:45AM +1000, Chris Smart wrote:
>> +#define PPC_INST_COPY 0x7c00060c
>> +#define PPC_INST_COPY_FIRST 0x7c20060c
>
>> +#define PPC_INST_PASTE 0x7c00070c
>> +#define PPC_INST_PASTE_LAST 0x7c20070d
>
>That's not quite right I think.
>
Hi Segher,
Thanks for checking that for me, it's good to make sure it's correct.
Just to be sure, I've gone back and compared them all with the ISA. I
think that the only one that differs is the paste_last. Am I missing
something?
>copy is 7c00060c mask fc2007fe (or ffe007fe)
COPY = copy RA,RB,L (L=0)
31 //// L RA RB 774 /
011111 0000 0 00000 00000 1100000110 0 = 0x7c00060c (instruction)
111111 0000 1 00000 00000 1111111111 0 = 0xfc2007fe (specific mask)
>copy_first is 7c20060c mask fc2007fe
COPY_FIRST = copy RA,RB,L (L=1)
If L=1, the instruction identifies the beginning of a move group.
31 //// L RA RB 774 /
011111 0000 1 00000 00000 1100000110 0 = 0x7c20060c (instruction)
111111 0000 1 00000 00000 1111111111 0 = 0xfc2007fe (specific mask)
>paste is 7c00070c mask fc2007fe
PASTE = paste RA,RB,L (L=0 Rc=0)
31 //// L RA RB 902 Rc
011111 0000 0 00000 00000 1110000110 0 = 0x7c00070c (instruction)
111111 0000 1 00000 00000 1111111111 1 = 0xfc2007ff (specific mask)
>paste_last is 7c20070c mask fc2007fe
>
PASTE_LAST = paste. RA,RB,L (L=1 Rc=1)
If L=1, the instruction identifies the end of a move group.
If L≠Rc, the instruction form is invalid.
31 //// L RA RB 902 Rc
011111 0000 1 00000 00000 1110000110 1 = 0x7c20070d (instruction)
111111 0000 1 00000 00000 1111111111 1 = 0xfc2007ff (specific mask)
>(this includes record form for paste; the low bit).
>
To make the test simple I use a combined copy, copy_first, paste and
paste_last mask to compare just against copy. So that excluded:
- L
- bit 24 of 32
- Rc
111111 0000 0 00000 00000 1101111111 0 = 0xfc0006fe
Would it be better and more clear to check each instruction with its
mask? Something like:
#define PPC_INST_COPY_MASK 0xfc2007fe
#define PPC_INST_PASTE_MASK 0xfc2007ff
if (cpu_has_feature(CPU_FTR_ARCH_300)) {
unsigned int masked_instruction = instruction & PPC_INST_COPY_MASK;
if (masked_instruction == PPC_INST_COPY || \
masked_instruction == PPC_INST_COPY_FIRST)
return -EIO;
masked_instruction = instruction & PPC_INST_PASTE_MASK;
if (masked_instruction == PPC_INST_PASTE || \
masked_instruction == PPC_INST_PASTE_LAST)
return -EIO;
}
Thanks!
-c
next prev parent reply other threads:[~2016-06-21 0:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-16 23:33 [Patch v2 1/2] powerpc: Send SIGBUS on unaligned copy and paste Chris Smart
2016-06-17 4:04 ` Segher Boessenkool
2016-06-21 0:39 ` Chris Smart [this message]
2016-06-17 7:20 ` Balbir Singh
2016-06-19 23:48 ` Chris Smart
2016-06-20 3:06 ` Balbir Singh
2016-07-05 14:10 ` [v2,1/2] " Michael Ellerman
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=20160621003909.GA11166@distroguy.com \
--to=chris@distroguy.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/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).