On 2013-11-09 08:42:46 -0600, Rob said:
On Sat, Nov 09, 2013 at 08:13:13AM -0600, Blake McBride wrote: So forget that, the other approach is to manually forward the registers. This is roughly what optimised disassembly of the above forward function would look like, if you got gcc to tail-call and not do any frame setup. .globl forward forward: // any free register that's not preserved across calls movq %rdi, %r10 // forward call registers movq %rsi, %rdi movq %rdx, %rsi movq %rcx, %rdx movq %r8, %rdx movq %r9, %r8 // return address is at (%rsp), so we can just jump jmp *%r10 HTH, Rob
I corrected your small %rdx typo above and tried the following. It doesn't work either though. Knowing what I know now though, you must be close.
.globl __jumpToMethod __jumpToMethod: LFB2: pushq %rbp LCFI0: movq %rsp, %rbp LCFI1: movl $0, %eax // call *%rdi // leave // ret // any free register that's not preserved across calls movq %rdi, %r10 // forward call registers movq %rsi, %rdi movq %rdx, %rsi movq %rcx, %rdx movq %r8, %rcx movq %r9, %r8 // return address is at (%rsp), so we can just jump jmp *%r10 -- To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
- Follow-Ups:
- References:
- Need help doing a jmp rather than a call
- From: Blake McBride
- Re: Need help doing a jmp rather than a call
- From: Sofiane Akermoun
- Re: Need help doing a jmp rather than a call
- From: Blake McBride
- Re: Need help doing a jmp rather than a call
- From: Sofiane Akermoun
- Re: Need help doing a jmp rather than a call
- From: Sofiane Akermoun
- Re: Need help doing a jmp rather than a call
- From: Blake McBride
- Re: Need help doing a jmp rather than a call
- From: Rob
- Need help doing a jmp rather than a call
- Prev by Date: Re: Need help doing a jmp rather than a call
- Next by Date: Re: Need help doing a jmp rather than a call
- Previous by thread: Re: Need help doing a jmp rather than a call
- Next by thread: Re: Need help doing a jmp rather than a call
- Index(es):
![]() |