> Probably the attached (RFC) patch can be useful in this case. The
> patch allows to specify the label for xbegin, so it is possible to
> implement code like following (non-sensical) example:
It can be actually implemented using asm goto. I have some macros
for this. And the tree optimizers should even support it.
#define XBEGIN(label) \
asm volatile goto(".byte 0xc7,0xf8 ; .long %l0-1f\n1:" ::: "eax" :
label)
#define XEND() asm volatile(".byte 0x0f,0x01,0xd5")
#define XFAIL(label) label: asm volatile("" ::: "eax")
#define XFAIL_STATUS(label, status) label: asm volatile("" : "=a"
(status))
But the assembler code is still needed for this because the non TSX path needs
to save all registers (it's like a setjmp/longjmp), and that cannot
be implemented in C.
The goal of the assembler code was not to use the label, but to move
the initial transaction before the setjmp code.
-Andi