Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4094892pxb; Wed, 13 Oct 2021 20:53:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye+m7qA4dplCu/uyyIpw4YjG8S++3FnI7quOIggUhMwIWGQuIqU5iMew+kopLlky0h99z7 X-Received: by 2002:a17:90a:2:: with SMTP id 2mr18164388pja.77.1634183613214; Wed, 13 Oct 2021 20:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634183613; cv=none; d=google.com; s=arc-20160816; b=DOIvCBa/LkdIrUaKyNMWFfPG6BYWP60D35IynQsrI4y6KQh5o6vpl+AoWK87tEmhUZ MxeBLs6jKS7QmCPhNDg7T6rdHzpzcr41XdavqzD9VPGog5q79h4A6Ey0/xAON/j0ct2y hn3G9AV10Ze844JYDfCaQFdhWetexe0g2D7EA3KsS1bXwaHd01OYUFwQT1Y3pdU4htnB BOeFKKJkbkGqHbfhyxBieVAVfWf6M83lfZqtfRFRXdMp7PgW/vGEJHOw5SgtIT3ru/aW etXMsrr+8s6Fzvf3CjG1krR8Ah163yNMnxY/KkozD1utxLVb/on4UZ9AODPHFKOKdC2Z cwSQ== 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=s4xTx9uXh+TQYumyL6QT72i8i7PX2Kdt0mjHDXtVPEA=; b=hsv1pF26AkNBKKnGQKg+lykPTe7MupgvCR8b1rkwwsTKWbTiyPb8W/XnN8nA3YG914 aaRdHiLVmsf4uCD4XpmUX+sY4EHBmVe30mKCmBz5aGt1/jPsL2rCkoz1hNhPnFToEipz Qmo/9iTsPjcnRlfMHhN79ExCSsP8L1N7hwTZJR2v67m3NqY5x6GrV88cM31SyT5P4+LY yzSfdlmMKnmBGslhYv+knr2ZF6Wsz2x3p3WQzMB2gcpNUm2sfTDcSbTsSOMQejTZgccM IePICrK/8uxRjcB/UPzLNYsvIwt4b/3P9R2iRJ/WtQ8Iom1U3jnvZdEMfYxBi4LgQ34P RV6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bKjBM5zv; 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 j3si2038140pgp.88.2021.10.13.20.53.20; Wed, 13 Oct 2021 20:53:33 -0700 (PDT) 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=bKjBM5zv; 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 S230180AbhJNDxW (ORCPT + 99 others); Wed, 13 Oct 2021 23:53:22 -0400 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 S229966AbhJNDxV (ORCPT ); Wed, 13 Oct 2021 23:53:21 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18BEBC061570 for ; Wed, 13 Oct 2021 20:51:17 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id f5so4250613pgc.12 for ; Wed, 13 Oct 2021 20:51:17 -0700 (PDT) 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=s4xTx9uXh+TQYumyL6QT72i8i7PX2Kdt0mjHDXtVPEA=; b=bKjBM5zvSD9U12vC8f7pvAaqwweMeduCm88+NMeXgi+uWDoRfiQWtNRRUOvAaRshig Fes6dvBSj53auToDD6GCQ9BYkViXj/wF90eb4drzr+zCcdZuO0vXowkIHety5J3W1qjy ERY5iUqv3DGWrEO+8WgRNPImvR2FUjchV75ri4jRoJrOPUigUA3Jw9UnlmxL9ZexwkSQ RrzybpcPzdE6KaWKXe7IDiBa23sI4STAyzGrvG6KWysRiOTAiSgdlZY0A8cOMFuuhhJW UwaHF4gqxHwH8j6f2zkGnxgYpkIKnHEI0dJStJIMXlfZMukYXjtkFjcsjaWs7RSQ6i1m RJmg== 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=s4xTx9uXh+TQYumyL6QT72i8i7PX2Kdt0mjHDXtVPEA=; b=q0RGtbjhd+oO6y28R41d95tJIhyyMTmLvzW2VJhaW19bVF1SDDvXHT7LyI1L+X5cL1 4ICdtamMmQKVp/u2n0URsgcwfqYFdZF/dYzV3qH3551RqiYGoXx0WvVGHDMkpxsT5WQR ncC/atYG3OuT/rcSq+f8viZHNDV4Vi3ATLQf1e+4G4vLjlThhqXqH2YtXM8jThznRf2F 5YNp4q8/+EPWlj4tcKSGXRuDzFd2QbjtuXp8peobZeB83A8JyC6M8xPDnHPofeyOwHnU ZAVjOziDn1guZzkTu5F0KgV8Q6re39Xr3BsfbZjOsA9jdsXah4y3jfSEJVq7ruT6KSI0 mNNg== X-Gm-Message-State: AOAM5320lyLZmTR25GtPyaRWGjxYDE6Y0GCxVX6rleozddn3ltzZz7wJ ruc11w0y5+X3pnRp94he6tacipmbLBQ= X-Received: by 2002:a05:6a00:22d4:b0:44d:1c39:a8d3 with SMTP id f20-20020a056a0022d400b0044d1c39a8d3mr3314474pfj.56.1634183476484; Wed, 13 Oct 2021 20:51:16 -0700 (PDT) Received: from localhost ([47.88.5.130]) by smtp.gmail.com with ESMTPSA id k9sm864641pfa.88.2021.10.13.20.51.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Oct 2021 20:51:16 -0700 (PDT) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Lai Jiangshan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Juergen Gross , "Peter Zijlstra (Intel)" , Joerg Roedel Subject: [PATCH V3 42/49] x86/entry: Add a C macro to define the function body for IST in .entry.text with an error code Date: Thu, 14 Oct 2021 11:50:19 +0800 Message-Id: <20211014035027.17681-7-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20211014031413.14471-1-jiangshanlai@gmail.com> References: <20211014031413.14471-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 Add DEFINE_IDTENTRY_IST_ETNRY_ERRORCODE() macro to define C code to implement the ASM code which calls paranoid_entry(), modify orig_ax, cfunc(), paranoid_exit() in series for IST exceptions with an error code. Not functional difference intended. Signed-off-by: Lai Jiangshan --- arch/x86/include/asm/idtentry.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h index 57636844b0fd..c57606948433 100644 --- a/arch/x86/include/asm/idtentry.h +++ b/arch/x86/include/asm/idtentry.h @@ -351,6 +351,22 @@ __visible __entry_text void ist_##func(struct pt_regs *regs) \ ist_paranoid_exit(cr3, gsbase); \ } +/** + * DEFINE_IDTENTRY_IST_ENTRY_ERRORCODE - Emit __entry_text code for IST + * entry points with an error code + * @func: Function name of the entry point + */ +#define DEFINE_IDTENTRY_IST_ETNRY_ERRORCODE(func) \ +__visible __entry_text void ist_##func(struct pt_regs *regs) \ +{ \ + unsigned long cr3, gsbase, error_code = regs->orig_ax; \ + \ + ist_paranoid_entry(&cr3, &gsbase); \ + regs->orig_ax = -1; /* no syscall to restart */ \ + func(regs, error_code); \ + ist_paranoid_exit(cr3, gsbase); \ +} + /** * DEFINE_IDTENTRY_IST - Emit code for IST entry points * @func: Function name of the entry point -- 2.19.1.6.gb485710b