From nobody Mon Feb 9 12:44:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1632861094; cv=none; d=zohomail.com; s=zohoarc; b=SQVo+wYJ+NXCd7uOKrZaWhibllPKYECeMoB8n6Wh8B99Wg5APCyBkFV37vO1ClaG8WrhVYTO8GG+S7CiL6cGt4oGn46ywoPlGIrcXs66QrmVu9HD1hyqOtILySGmfEeAmQaQZt2yp7fNGkR2j+NFtykiO1/lGrwSZOElinkI5TM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632861094; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=er5faQ/st6GZye51adynMEU5HSlpMR7iwTJec4b9TtQ=; b=mFud+0pJwW8rb9so1kYqFdJ9nSA1v6f1+LOPBCR6S2EiY5BfWowvvXyry157V7Nc01YhSPMfKQ/o3C9/EvH65WE8QfYofxcOsWHaPzPxF2UkyaIMMKzkfQLKKtTthTaSc8ghnl0rs/2CFStCf+ajR+nhF62DbndrffJ/HINNd78= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632861094977549.9886862111271; Tue, 28 Sep 2021 13:31:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.198423.351955 (Exim 4.92) (envelope-from ) id 1mVJl3-0006tJ-FP; Tue, 28 Sep 2021 20:31:21 +0000 Received: by outflank-mailman (output) from mailman id 198423.351955; Tue, 28 Sep 2021 20:31:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mVJl3-0006t8-Bs; Tue, 28 Sep 2021 20:31:21 +0000 Received: by outflank-mailman (input) for mailman id 198423; Tue, 28 Sep 2021 20:31:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mVJl2-0004O5-9I for xen-devel@lists.xenproject.org; Tue, 28 Sep 2021 20:31:20 +0000 Received: from mail-pf1-x42f.google.com (unknown [2607:f8b0:4864:20::42f]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ad3a4beb-484e-4986-b3e6-d1314893e9a2; Tue, 28 Sep 2021 20:30:57 +0000 (UTC) Received: by mail-pf1-x42f.google.com with SMTP id w19so19832006pfn.12 for ; Tue, 28 Sep 2021 13:30:57 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::5]) by smtp.gmail.com with ESMTPSA id p15sm44201pfn.31.2021.09.28.13.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 13:30:55 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: ad3a4beb-484e-4986-b3e6-d1314893e9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=er5faQ/st6GZye51adynMEU5HSlpMR7iwTJec4b9TtQ=; b=o85TT2UfMEB+cmfXfH4HpYaImrks1IEaD2YggbPCmcwkX9St2K8GM9HI9JyW2Yj0Hr g0p6meZ1346IppM4mS0I7rXJ+KGkorCm3594/SQAQJafbuORffI4kzanmc9pHNITfxXJ sLvvznt1/Qsd4TCUP/kYJJ57eigIqtg2QZEE5aNc9xzPFQPHB2aCHovOND/TMOZbV0yd zjM512H29H+ooNuLUMCnM3vPcv2Mxmwa4spCgR4Jnunzu6/AwzQncwF7a66b7bhrKAHz tt5J2vdvHVroEuJA8lnCs43rPN8LS+bV777aP3kTnxzx2OsskhcR7kS5mzQr9n1j+4Pq 1vmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=er5faQ/st6GZye51adynMEU5HSlpMR7iwTJec4b9TtQ=; b=YVKH3UyHBRAm+SfliQJxU6wre/HxVD2NBKxmQO/KhITvfASJ880Ng3GReD1MlI+L9j QSvRyLlZUP4P7/2YwRTPXQ8/ZQFbpSeugksh0KUpNSAwrPFoWAlrlzI0V2RZib1ph+k0 zSBINFqPYrIrTGd5DqR4z4gOdklS7Br7Lb3HnoGmqua4ftLdmENv4WzJ2Fondw73xYKp f8xPmYEzYDRX7Sl6gD/21cNEHv13hf4cONl5fjoTDHd/FuOb/r+SmekT3VD1uKhntNOw hSq1M6oJcCWflelUicqmSjqk+ZwBQj/E2gWU0p7SGQo2+8DbW5EqIEodRZV3rhzcPtyw eGwg== X-Gm-Message-State: AOAM533fo6CucR60qcYs8tgypfVw8VG52Al4wF0k2ZT+W+dswG0dPRCi DI+eu1AVs161bVLYRCLlfFVnEV/lSlqvCykI X-Google-Smtp-Source: ABdhPJxiI0TvKS/plq0MCTX0bETK0mqEoV9I6fx4ued2x3fw34vZ90o7HgedhDr+VfoqMwzxvzdthg== X-Received: by 2002:a63:3408:: with SMTP id b8mr6418520pga.340.1632861056227; Tue, 28 Sep 2021 13:30:56 -0700 (PDT) Sender: Bobby Eshleman From: Bobby Eshleman To: xen-devel@lists.xenproject.org Cc: Bobby Eshleman , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Elena Ufimtseva , George Dunlap , Ian Jackson Subject: [PATCH v4 6/6] x86: change asm/debugger.h to xen/debugger.h Date: Tue, 28 Sep 2021 13:30:29 -0700 Message-Id: <8c340b24b41af349069ad55e1f0421e17fad1d6f.1632860589.git.bobby.eshleman@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1632861096199100001 Content-Type: text/plain; charset="utf-8" This commit allows non-x86 architecture to omit the file asm/debugger.h if they do not require it. It changes debugger.h to be a general xen/debugger.h which, if CONFIG_CRASH_DEBUG, resolves to include asm/debugger.h. It also changes all asm/debugger.h includes to xen/debugger.h. Because it is no longer required, arm/debugger.h is removed. Signed-off-by: Bobby Eshleman --- Changes in v4: - Replace #include with `struct cpu_user_regs` xen/arch/x86/traps.c | 1 + xen/common/domain.c | 2 +- xen/common/gdbstub.c | 2 +- xen/common/keyhandler.c | 2 +- xen/common/shutdown.c | 2 +- xen/drivers/char/console.c | 2 +- xen/include/asm-arm/debugger.h | 15 ---------- xen/include/asm-x86/debugger.h | 15 ---------- xen/include/xen/debugger.h | 51 ++++++++++++++++++++++++++++++++++ 9 files changed, 57 insertions(+), 35 deletions(-) delete mode 100644 xen/include/asm-arm/debugger.h create mode 100644 xen/include/xen/debugger.h diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 742fa9e2ca..36d7fc6238 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/common/domain.c b/xen/common/domain.c index 6b71c6d6a9..a87d814b38 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c index 848c1f4327..1d7b98cdac 100644 --- a/xen/common/gdbstub.c +++ b/xen/common/gdbstub.c @@ -38,12 +38,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include =20 diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 8b9f378371..1eafaef9b2 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -3,6 +3,7 @@ */ =20 #include +#include #include #include #include @@ -20,7 +21,6 @@ #include #include #include -#include #include =20 static unsigned char keypress_key; diff --git a/xen/common/shutdown.c b/xen/common/shutdown.c index abde48aa4c..a933ee001e 100644 --- a/xen/common/shutdown.c +++ b/xen/common/shutdown.c @@ -2,13 +2,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include =20 /* opt_noreboot: If true, machine will need manual reset on error. */ diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 7d0a603d03..3d1cdde821 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,6 @@ #include #include #include -#include #include #include /* for do_console_io */ #include diff --git a/xen/include/asm-arm/debugger.h b/xen/include/asm-arm/debugger.h deleted file mode 100644 index ac776efa78..0000000000 --- a/xen/include/asm-arm/debugger.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ARM_DEBUGGER_H__ -#define __ARM_DEBUGGER_H__ - -#define debugger_trap_fatal(v, r) (0) -#define debugger_trap_immediate() ((void) 0) - -#endif /* __ARM_DEBUGGER_H__ */ -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index 8f6222956e..b9eeed395c 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -25,9 +25,6 @@ #include #include #include - -#ifdef CONFIG_CRASH_DEBUG - #include =20 static inline bool debugger_trap_fatal( @@ -40,16 +37,4 @@ static inline bool debugger_trap_fatal( /* Int3 is a trivial way to gather cpu_user_regs context. */ #define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ); =20 -#else - -static inline bool debugger_trap_fatal( - unsigned int vector, struct cpu_user_regs *regs) -{ - return false; -} - -#define debugger_trap_immediate() ((void)0) - -#endif - #endif /* __X86_DEBUGGER_H__ */ diff --git a/xen/include/xen/debugger.h b/xen/include/xen/debugger.h new file mode 100644 index 0000000000..ddaa4a938b --- /dev/null +++ b/xen/include/xen/debugger.h @@ -0,0 +1,51 @@ +/*************************************************************************= ***** + * Generic hooks into arch-dependent Xen. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . + * + * Each debugger should define two functions here: + * + * 1. debugger_trap_fatal(): + * Called when Xen is about to give up and crash. Typically you will use = this + * hook to drop into a debug session. It can also be used to hook off + * deliberately caused traps (which you then handle and return non-zero). + * + * 2. debugger_trap_immediate(): + * Called if we want to drop into a debugger now. This is essentially the + * same as debugger_trap_fatal, except that we use the current register s= tate + * rather than the state which was in effect when we took the trap. + * For example: if we're dying because of an unhandled exception, we call + * debugger_trap_fatal; if we're dying because of a panic() we call + * debugger_trap_immediate(). + */ + +#ifndef __XEN_DEBUGGER_H__ +#define __XEN_DEBUGGER_H__ + +#ifdef CONFIG_CRASH_DEBUG + +#include + +#else + +struct cpu_user_regs; + +static inline bool debugger_trap_fatal( + unsigned int vector, const struct cpu_user_regs *regs) +{ + return false; +} + +static inline void debugger_trap_immediate(void) +{ +} + +#endif /* CONFIG_CRASH_DEBUG */ + +#endif /* __XEN_DEBUGGER_H__ */ --=20 2.32.0