From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752361AbdKUCeX (ORCPT ); Mon, 20 Nov 2017 21:34:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57184 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbdKUCeV (ORCPT ); Mon, 20 Nov 2017 21:34:21 -0500 Date: Mon, 20 Nov 2017 20:34:19 -0600 From: Josh Poimboeuf To: Andy Lutomirski Cc: X86 ML , Borislav Petkov , "linux-kernel@vger.kernel.org" , Brian Gerst , Dave Hansen , Linus Torvalds Subject: Re: [PATCH 13/16] x86/entry/64: Create a percpu SYSCALL entry trampoline Message-ID: <20171121023419.vs6mpg3ip5xklmvl@treble> References: <092b216eb666173f435ad6f8848bfc0069ff7714.1511195781.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <092b216eb666173f435ad6f8848bfc0069ff7714.1511195781.git.luto@kernel.org> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 21 Nov 2017 02:34:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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