On Mon, Feb 13, 2012 at 11:57 PM, Richard Henderson <[email protected]> wrote:
> On 02/13/2012 02:54 PM, Uros Bizjak wrote:
>> - movq 56(%rsi), %rdx
>> movl %edi, %eax
>> cfi_def_cfa(%rcx, 0)
>> - cfi_register(%rip, %rdx)
>> movq %rcx, %rsp
>> - jmp *%rdx
>> + jmp *56(%rsi)
>
> If you're going to do that, the correct fix for the unwind info is
>
> - cfi_register(%rip, %rdx)
> + cfi_offset(%rip, 56)
Hm, we just defined new CFA as rcx+0, so we should define location of
rip relative to new CFA. Since CFA points to stack slot just before
return address was pushed, new rip lies at CFA-8 for 64bit resp. CFA-4
for x86_32. Did I get these .cfi directives correctly?
SYM(GTM_longjmp):
cfi_startproc
#ifdef __x86_64__
movq (%rsi), %rcx
movq 8(%rsi), %rbx
movq 16(%rsi), %rbp
movq 24(%rsi), %r12
movq 32(%rsi), %r13
movq 40(%rsi), %r14
movq 48(%rsi), %r15
movl %edi, %eax
cfi_def_cfa(%rcx, 0)
cfi_offset(%rip, -8)
movq %rcx, %rsp
jmp *56(%rsi)
#else
movl (%edx), %ecx
movl 4(%edx), %ebx
movl 8(%edx), %esi
movl 12(%edx), %edi
movl 16(%edx), %ebp
cfi_def_cfa(%ecx, 0)
cfi_offset(%eip, -4)
movl %ecx, %esp
jmp *20(%edx)
#endif
cfi_endproc
Uros.