Re: [PATCH 13/16] x86/entry/64: Create a percpu SYSCALL entry trampoline
From: Josh Poimboeuf
Date: Mon Nov 20 2017 - 21:34:27 EST
On Mon, Nov 20, 2017 at 09:07:44AM -0800, Andy Lutomirski wrote:
> + /* Save RDI, since we need a scratch register. */
> + pushq %rdi
> +
> + /*
> + * x86 lacks a near absolute jump, and we can't jump to the real
> + * entry text with a relative jump, so we use a double trampoline.
> + */
> + movq $entry_SYSCALL_64_stage2, %rdi
> + jmp *%rdi
> +END(entry_SYSCALL_64_trampoline)
> +
> + .popsection
> +
> +ENTRY(entry_SYSCALL_64_stage2)
> + /*
> + * Rather than polluting the normal SYSCALL path with stack switching
> + * nonsense, fix up our register state to match its expectations.
> + */
> + UNWIND_HINT_EMPTY
> + popq %rdi
> + jmp entry_SYSCALL_64_after_hwframe
> +END(entry_SYSCALL_64_stage2)
Is there a reason why you couldn't just do the following?
pushq $entry_SYSCALL_64_after_hwframe
ret
Then you wouldn't need the 2nd trampoline and the %rdi clobber.
--
Josh