TM Bad Thing exception easily raised from userspace

Laurent Dufour ldufour at linux.vnet.ibm.com
Mon Aug 22 19:12:17 AEST 2016


On 19/08/2016 22:23, Segher Boessenkool wrote:
> 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]").

Thanks Segher for these advices, I'll keep them in mind.



More information about the Linuxppc-dev mailing list