Received: by 10.223.185.116 with SMTP id b49csp744273wrg; Wed, 21 Feb 2018 06:17:11 -0800 (PST) X-Google-Smtp-Source: AH8x227JxFYnqZWyNWVpJxx1U/8SKeh0R/jjx9PdiQLhM2w3pWrigPJdYxVV32mXf41tEX7Y6WI1 X-Received: by 10.101.77.69 with SMTP id j5mr2879424pgt.352.1519222631668; Wed, 21 Feb 2018 06:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519222631; cv=none; d=google.com; s=arc-20160816; b=tHCeM7MRKMxqDhP2+/0A5LR9WyjnNwLE0lF+fEtVgrJ0y+u1fkucin08J/7958P12V /wqnS2S5hE6Jrwx0e83CR4NhhwOibCUu+1QfD8bxpJpSSPviyqXOJ7kmkCADzRmfNcWG noqU4kHmCCt+3IJntZK/8c3FyOLm+GfZZF6NPTRpfCgVy3/pKfwC09wydQ3VaXs8P8vu MEcSbzLEJSoYqWgncJ9K9keZRA6JdUHLrL2E5RPJuBaY/ZgnE3+YveXdsoQOzPZIWH4a HnjcTqhkVi/TorKOL/M7swzvvAo3K/dFKRLO7+TXnI9Br8D1y9U4Mv+xxIA7HL74PWWu i0kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=l4TaSJFNSIXzYAsD68pMZycTLAPsPfPLeJEbVb05JN8=; b=zUv5nGdd2Z91BptHGLi96gES3QutLUqTDi+BSi6bN0zu4OrqPIKtA+BpNC+AKvPYR3 dhsJX79x7fsQmivoKaETt5GyC7SeCbz54ADYzVtEbRYZ8PMGna/rF5Mc0KP8KTNV2oNY ej3YPZ+DfX8OwoJB2ptiecWbwHcY8C8G0G4wem6UFKDZouu+WcTX6ojsk584wAUvXDf1 2kw3HM1HkwdBRZ6Gf64DVi2w2JoE5aK//pv2x5m9aT34cKNmFm10wxDdXuXH/6H9goeU ofvU0lkyRN8/B6zruWni+yHPloeHfbZCigirNtZlcrmOm2npSISzjwkl0V3R34FF8kZ4 v+Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si12018327pgr.136.2018.02.21.06.16.57; Wed, 21 Feb 2018 06:17:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935621AbeBUOOh (ORCPT + 99 others); Wed, 21 Feb 2018 09:14:37 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36958 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935281AbeBUNAS (ORCPT ); Wed, 21 Feb 2018 08:00:18 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8F67A101D; Wed, 21 Feb 2018 13:00:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Brodowski , Andy Lutomirski , Borislav Petkov , Brian Gerst , Denys Vlasenko , "H. Peter Anvin" , Josh Poimboeuf , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , dan.j.williams@intel.com, Ingo Molnar Subject: [PATCH 4.14 059/167] x86/entry/64: Merge the POP_C_REGS and POP_EXTRA_REGS macros into a single POP_REGS macro Date: Wed, 21 Feb 2018 13:47:50 +0100 Message-Id: <20180221124527.747244953@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dominik Brodowski commit 502af0d70843c2a9405d7ba1f79b4b0305aaf5f5 upstream. The two special, opencoded cases for POP_C_REGS can be handled by ASM macros. Signed-off-by: Dominik Brodowski Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: dan.j.williams@intel.com Link: http://lkml.kernel.org/r/20180211104949.12992-3-linux@dominikbrodowski.net Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/entry/calling.h | 15 +++++++++++---- arch/x86/entry/entry_64.S | 26 ++++---------------------- 2 files changed, 15 insertions(+), 26 deletions(-) --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@ -139,25 +139,32 @@ For 32-bit we have the following convent xorq %r15, %r15 .endm - .macro POP_EXTRA_REGS + .macro POP_REGS pop_rdi=1 skip_r11rcx=0 popq %r15 popq %r14 popq %r13 popq %r12 popq %rbp popq %rbx - .endm - - .macro POP_C_REGS + .if \skip_r11rcx + popq %rsi + .else popq %r11 + .endif popq %r10 popq %r9 popq %r8 popq %rax + .if \skip_r11rcx + popq %rsi + .else popq %rcx + .endif popq %rdx popq %rsi + .if \pop_rdi popq %rdi + .endif .endm .macro icebp --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -330,15 +330,7 @@ GLOBAL(entry_SYSCALL_64_after_hwframe) syscall_return_via_sysret: /* rcx and r11 are already restored (see code above) */ UNWIND_HINT_EMPTY - POP_EXTRA_REGS - popq %rsi /* skip r11 */ - popq %r10 - popq %r9 - popq %r8 - popq %rax - popq %rsi /* skip rcx */ - popq %rdx - popq %rsi + POP_REGS pop_rdi=0 skip_r11rcx=1 /* * Now all regs are restored except RSP and RDI. @@ -631,15 +623,7 @@ GLOBAL(swapgs_restore_regs_and_return_to ud2 1: #endif - POP_EXTRA_REGS - popq %r11 - popq %r10 - popq %r9 - popq %r8 - popq %rax - popq %rcx - popq %rdx - popq %rsi + POP_REGS pop_rdi=0 /* * The stack is now user RDI, orig_ax, RIP, CS, EFLAGS, RSP, SS. @@ -697,8 +681,7 @@ GLOBAL(restore_regs_and_return_to_kernel ud2 1: #endif - POP_EXTRA_REGS - POP_C_REGS + POP_REGS addq $8, %rsp /* skip regs->orig_ax */ INTERRUPT_RETURN @@ -1655,8 +1638,7 @@ end_repeat_nmi: nmi_swapgs: SWAPGS_UNSAFE_STACK nmi_restore: - POP_EXTRA_REGS - POP_C_REGS + POP_REGS /* * Skip orig_ax and the "outermost" frame to point RSP at the "iret"