From: Segher Boessenkool <segher@kernel.crashing.org>
To: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Simon Guo <wei.guo.simon@gmail.com>
Subject: Re: TM Bad Thing exception easily raised from userspace
Date: Fri, 19 Aug 2016 15:23:31 -0500 [thread overview]
Message-ID: <20160819202331.GA18558@gate.crashing.org> (raw)
In-Reply-To: <fb29f778-75c5-088c-fe40-e03d95b901e0@linux.vnet.ibm.com>
Completely off-topic, but...
On Fri, Aug 19, 2016 at 07:21:44PM +0200, Laurent Dufour wrote:
> asm __volatile__(
> "li 3,1 ;"
> "tbegin. ;"
> "beq 1f ;"
> "li 3,0 ;"
> "tsuspend. ;"
> "1: ;"
> "std 3, %[ret] ;"
> : [ret]"=m"(ret)
> :
> : "memory", "3");
This asm clobbers CR0, so you should add a "cc" or "cr0" clobber here.
When you use "m" you need "%X" as well, i.e.
std%X[ret] 3,%[ret]
(Nowadays you only need "%U" if you use "m<>", but you still need "%X".
Come to think of it, the kernel supports really old GCC, right? So you
need "std%U[ret]%X[ret] 3,%[ret]").
> asm __volatile__(
> "tbegin. ;"
> "beq 1f ;"
> "li 3,0 ;"
> "std 3,0(3) ;" /* Oups ! */
> "1: ;"
> "tend. ;"
> );
Here "cc" (or "cr0"), too.
Segher
next prev parent reply other threads:[~2016-08-19 20:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-19 17:21 TM Bad Thing exception easily raised from userspace Laurent Dufour
2016-08-19 20:23 ` Segher Boessenkool [this message]
2016-08-22 9:12 ` Laurent Dufour
2016-08-22 2:08 ` Michael Neuling
2016-08-22 4:18 ` Cyril Bur
2016-08-22 9:45 ` Laurent Dufour
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=20160819202331.GA18558@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=ldufour@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=wei.guo.simon@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.