Re: [PATCH 13/16] x86/entry/64: Create a percpu SYSCALL entry trampoline

2017-11-20 Thread Andy Lutomirski
On Mon, Nov 20, 2017 at 6:34 PM, Josh Poimboeuf wrote: > 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

Re: [PATCH 13/16] x86/entry/64: Create a percpu SYSCALL entry trampoline

2017-11-20 Thread Andy Lutomirski
On Mon, Nov 20, 2017 at 6:34 PM, Josh Poimboeuf wrote: > 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 >>

Re: [PATCH 13/16] x86/entry/64: Create a percpu SYSCALL entry trampoline

2017-11-20 Thread Josh Poimboeuf
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

Re: [PATCH 13/16] x86/entry/64: Create a percpu SYSCALL entry trampoline

2017-11-20 Thread Josh Poimboeuf
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

[PATCH 13/16] x86/entry/64: Create a percpu SYSCALL entry trampoline

2017-11-20 Thread Andy Lutomirski
Handling SYSCALL is tricky: the SYSCALL handler is entered with every single register (except FLAGS), including RSP, live. It somehow needs to set RSP to point to a valid stack, which means it needs to save the user RSP somewhere and find its own stack pointer. The canonical way to do this is

[PATCH 13/16] x86/entry/64: Create a percpu SYSCALL entry trampoline

2017-11-20 Thread Andy Lutomirski
Handling SYSCALL is tricky: the SYSCALL handler is entered with every single register (except FLAGS), including RSP, live. It somehow needs to set RSP to point to a valid stack, which means it needs to save the user RSP somewhere and find its own stack pointer. The canonical way to do this is