This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, libitm]: GTM_longjmp: Jump indirect from memory address


On 02/13/2012 04:09 PM, Uros Bizjak wrote:
> On Mon, Feb 13, 2012 at 11:57 PM, Richard Henderson <rth@redhat.com> 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?

No.  The value at %rcx-8 is total garbage.  There no guarantee that
the call stack leading to this abort has anything in common with the
call stack that created the jmpbuf, except *above* %rcx, the new CFA.

The new rip is at rsi+56.  You can see that in that you jump to it.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]