diff mbox

[libitm] : GTM_longjmp: Jump indirect from memory address

Message ID CAFULd4YzWpYM2YNbND0frv1UBHL2L69eVa4Aax7JfKtoW2Es7g@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Feb. 14, 2012, 6:26 p.m. UTC
On Tue, Feb 14, 2012 at 7:07 PM, Richard Henderson <rth@redhat.com> wrote:
> On 02/13/2012 11:54 PM, Uros Bizjak wrote:
>>       movq    48(%rsi), %r15
>> -     movq    56(%rsi), %rdx
>>       movl    %edi, %eax
>> +     cfi_offset(%rip, 56)
>>       cfi_def_cfa(%rcx, 0)
>> -     cfi_register(%rip, %rdx)
>>       movq    %rcx, %rsp
>> -     jmp     *%rdx
>> +     jmp     *56(%rsi)
>
> I'm sorry, I was mistaken earlier.  The rip value is not at CFA+56, it's at RSI+56.
> The way to describe this is
>
>        cfi_def_cfa(%rsi, 0)
>        cfi_offset(%rip, 56)
>        cfi_register(%rsp, %rcx)

Yes, IMO this now describes correct CFA handling. Following follow-on
patch corrects this issue (and also puts .cfi directions to the place
where they make most sense, mainly a cosmetic change).

Re-tested on x86_64-pc-linux-gnu {,-m32} and committed.

Thanks,
Uros.
diff mbox

Patch

Index: config/x86/sjlj.S
===================================================================
--- config/x86/sjlj.S	(revision 184213)
+++ config/x86/sjlj.S	(working copy)
@@ -112,6 +112,7 @@ 
 SYM(GTM_longjmp):
 	cfi_startproc
 #ifdef __x86_64__
+	cfi_def_cfa(%rsi, 0)
 	movq	(%rsi), %rcx
 	movq	8(%rsi), %rbx
 	movq	16(%rsi), %rbp
@@ -119,20 +120,21 @@ 
 	movq	32(%rsi), %r13
 	movq	40(%rsi), %r14
 	movq	48(%rsi), %r15
+	cfi_offset(%rip, 56)
 	movl	%edi, %eax
-	cfi_offset(%rip, 56)
-	cfi_def_cfa(%rcx, 0)
 	movq	%rcx, %rsp
+	cfi_register(%rsp, %rcx)
 	jmp	*56(%rsi)
 #else
+	cfi_def_cfa(%edx, 0)
 	movl	(%edx), %ecx
 	movl	4(%edx), %ebx
 	movl	8(%edx), %esi
 	movl	12(%edx), %edi
 	movl	16(%edx), %ebp
 	cfi_offset(%eip, 20)
-	cfi_def_cfa(%ecx, 0)
 	movl	%ecx, %esp
+	cfi_register(%esp, %ecx)
 	jmp	*20(%edx)
 #endif
 	cfi_endproc