Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp424971pxh; Wed, 10 Nov 2021 04:03:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyATudcTLPq1bqgAVTACfVOCkKP5fombDtskQiUyI1mmZeyOhQiVFvGmDKvyY/ohanC5bw X-Received: by 2002:a17:907:c0c:: with SMTP id ga12mr21398641ejc.417.1636545836846; Wed, 10 Nov 2021 04:03:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636545836; cv=none; d=google.com; s=arc-20160816; b=LcSsKawu/CHDR9zYECwrtUN8FFZq38t9BtHuCg+098/WNPoY43enpycULbQvYfoV/x K24Y4C37q/w7nbYcMm6rUR+mn4EMGfH1hJ/VsVv3aDfKYhybhjO1lLPZOk4soFWx7iQJ h9BH7ChbYgMhWwAkCsLwCDM8KHIx4V+NBL77lT6udK2xUTlKt8977HG3FyIy31mP7ppB KWnG2n93UKYdnLZIIUScCcjoGshoj0ZCHgRXXx/2pj2tqNzPS+YrONQSHr8FWUyEl0im cKY08a7Jix0etylDbK+blVlU04bLtKndE0vwNykbvlDpa977JmJr0PNfCdwexosbpOoz PqOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xAn3vfiaZfcMYiuIkw8EeNN2gx46F0qh2+zND/QhCg0=; b=KAF1KdK0Lph/Omrw/qSbe/8RamZqIlNKTFe4iPdDx6vC28wgaWGESnC5THpDbKB8qD 6f5cf3qQo3ZFgTg7wfiGQt7mPLxLnG1QhNofOgu+lBNA5nfY1h/L0fioMu2tHdve9hjl 75iHniFq1aO6tbUGwvU2QfZ2OS7iRj+2uuq8Jzgq8p4mTGJv931mnrcXSSSvjorIPhKy 3ykMkN7M+N/zlmlL5LJI2Hs13Kb0Q6toObJh7tm046KcsHDNqmPUCG5mU2wHaAatJIQI enPaoH8Mx+GKjl8N7MUBtsDamMXg8sAHntWnq+8P2jZiAMTFfxgz3hUFTh7ZgrBva7I9 8ocQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aB0ONDNl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id go39si40058406ejc.519.2021.11.10.04.03.28; Wed, 10 Nov 2021 04:03:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aB0ONDNl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231542AbhKJMDe (ORCPT + 99 others); Wed, 10 Nov 2021 07:03:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231571AbhKJMDY (ORCPT ); Wed, 10 Nov 2021 07:03:24 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363BDC06127A for ; Wed, 10 Nov 2021 04:00:37 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id fv9-20020a17090b0e8900b001a6a5ab1392so1481214pjb.1 for ; Wed, 10 Nov 2021 04:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xAn3vfiaZfcMYiuIkw8EeNN2gx46F0qh2+zND/QhCg0=; b=aB0ONDNlVI2mMoUizSwACie89vO0Ppt8cD0K3LEc8GN33YFn52yhIvMueZ14zlwVa0 faZ1TcTvW9rfuOgWzes7E8R6XzARHu0t1rbjz6nZnDKo4sAaqgOKOj9ocwArAgT0FFOI DYbnTGYzZmaeaoEYOvP9ZTce6KkVXSGIcmOaOOs1yDHQl3IXYJhp1diJLgVpcTU1nWWw eftUTVL5fg8Vr+EwUamTFtVJAhO65u+0s1OsAzUenNwS2q3XcfiBnk51RCZxEO+QvoMp 07D9fKEdZM4TIDMMygz5vBmEU6yk2S5hSgWloAI31rKllLOkdAzUkJ1jQjmK9qeA7HOE DVIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xAn3vfiaZfcMYiuIkw8EeNN2gx46F0qh2+zND/QhCg0=; b=GQTxSJftcnguPJoZpQo3oi6Mc88l8j/NGP+6l8YxYAat2LJXDw742xyT1weXKyICee oQm4dIY1n9BxJY0lTbSPjWRfoL2Mt+60X7HzL2/hcCl3ifCLngE19dkAYh2/AiIF1/w3 38CgaU/sayaP7bKI4oZsIl+lYw2XC6LR8u1Daf7ofsNUhDKHCC+wnTfsZ7+rX1HwhDlV n18pcPZIpTCdc3JlNkFTppJ332FoVeWTDjtbXI+3Glhyl1Engb6KA+P6ppKteXAasvfq pae4bHRwul7EvXLBgsMXtww0C5UJrtOno9MImCANhrSK2V7gAbgNGhkgGA6suVBPTRLC YCyw== X-Gm-Message-State: AOAM532zXKNirhafpZvMwf2aN65Kqp7qBcm0PKSxNovVz4bu+dYq3tpZ GugqWmtmSGw+8I2ZEt9nIXbC5p4k6FU= X-Received: by 2002:a17:90b:351:: with SMTP id fh17mr16303680pjb.19.1636545636546; Wed, 10 Nov 2021 04:00:36 -0800 (PST) Received: from localhost ([198.11.178.15]) by smtp.gmail.com with ESMTPSA id a11sm9235543pfh.108.2021.11.10.04.00.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Nov 2021 04:00:36 -0800 (PST) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Lai Jiangshan , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH V5 30/50] x86/entry: move PUSH_AND_CLEAR_REGS out of paranoid_entry Date: Wed, 10 Nov 2021 19:57:16 +0800 Message-Id: <20211110115736.3776-31-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20211110115736.3776-1-jiangshanlai@gmail.com> References: <20211110115736.3776-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Jiangshan It is prepared for converting the whole paranoid_entry() into C code. No functional change intended. Signed-off-by: Lai Jiangshan --- arch/x86/entry/entry_64.S | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 3a434b179963..b6bcf7fcad34 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -322,9 +322,6 @@ SYM_CODE_END(ret_from_fork) */ .macro idtentry_body cfunc has_error_code:req - PUSH_AND_CLEAR_REGS - ENCODE_FRAME_POINTER - /* * Call error_entry and switch stack settled by sync_regs(). * @@ -403,6 +400,9 @@ SYM_CODE_START(\asmsym) .Lfrom_usermode_no_gap_\@: .endif + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + idtentry_body \cfunc \has_error_code _ASM_NOKPROBE(\asmsym) @@ -455,11 +455,14 @@ SYM_CODE_START(\asmsym) pushq $-1 /* ORIG_RAX: no syscall to restart */ + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + /* * If the entry is from userspace, switch stacks and treat it as * a normal entry. */ - testb $3, CS-ORIG_RAX(%rsp) + testb $3, CS(%rsp) jnz .Lfrom_usermode_switch_stack_\@ /* paranoid_entry returns GS information for paranoid_exit in EBX. */ @@ -510,11 +513,14 @@ SYM_CODE_START(\asmsym) ASM_CLAC cld + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + /* * If the entry is from userspace, switch stacks and treat it as * a normal entry. */ - testb $3, CS-ORIG_RAX(%rsp) + testb $3, CS(%rsp) jnz .Lfrom_usermode_switch_stack_\@ /* @@ -573,6 +579,9 @@ SYM_CODE_START(\asmsym) ASM_CLAC cld + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + /* paranoid_entry returns GS information for paranoid_exit in EBX. */ call paranoid_entry UNWIND_HINT_REGS @@ -888,8 +897,6 @@ SYM_CODE_END(xen_failsafe_callback) */ SYM_CODE_START_LOCAL(paranoid_entry) UNWIND_HINT_FUNC - PUSH_AND_CLEAR_REGS save_ret=1 - ENCODE_FRAME_POINTER 8 /* * Always stash CR3 in %r14. This value will be restored, @@ -1307,6 +1314,9 @@ end_repeat_nmi: */ pushq $-1 /* ORIG_RAX: no syscall to restart */ + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + /* * Use paranoid_entry to handle SWAPGS and CR3. */ -- 2.19.1.6.gb485710b