From patchwork Fri Feb 3 17:05:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13128110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 544CAC61DA4 for ; Fri, 3 Feb 2023 17:06:34 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.489261.757610 (Exim 4.92) (envelope-from ) id 1pNzVf-0002cs-5R; Fri, 03 Feb 2023 17:05:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 489261.757610; Fri, 03 Feb 2023 17:05:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pNzVf-0002be-1U; Fri, 03 Feb 2023 17:05:59 +0000 Received: by outflank-mailman (input) for mailman id 489261; Fri, 03 Feb 2023 17:05:57 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pNzVd-0002ZN-Q5 for xen-devel@lists.xenproject.org; Fri, 03 Feb 2023 17:05:57 +0000 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [2a00:1450:4864:20::436]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0663cefd-a3e5-11ed-933c-83870f6b2ba8; Fri, 03 Feb 2023 18:05:57 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id m14so5202688wrg.13 for ; Fri, 03 Feb 2023 09:05:57 -0800 (PST) Received: from 34-6F-24-FC-D2-65.. (46.204.104.21.nat.umts.dynamic.t-mobile.pl. [46.204.104.21]) by smtp.gmail.com with ESMTPSA id f17-20020a5d50d1000000b002bfe266d710sm2452191wrt.90.2023.02.03.09.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 09:05:55 -0800 (PST) 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 Sender: "Xen-devel" X-Inumbo-ID: 0663cefd-a3e5-11ed-933c-83870f6b2ba8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4+ff1E7mX9WhYpbpoBrQzNoWKjRBFV88fd7wUihi2Qc=; b=fyMBwyuNo6g5Xnun+n9KPuzqpdI1HAlf+fhuLWm3WTQydKG+afSiJrUXVMDZHwdYIr S7Acw7HKIRvBgnbOwJLI/CO5PLIynKjHJGCiE98g6M2yIcvzfZXDxjJIT1A970G2WepJ QIpfwg6O3kEpPv4WOZk3A34Pt2CL24cTe4XlgYDJVLVKGifEmdctHXNFYjXHlvvKyw8E BdcdVpFO1b2n/gUXA2Lcicd9fU6ff1DLuso4qC2fUk1dKaRhzH/CESeUBbuD6AmprLEs 2L2mcQmQ+1pkp2poTTuMgcuhF3TEjVffWV3YVvQQlqZrWTFwbsYj3lDcHfOyUk7XsSn1 uP0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4+ff1E7mX9WhYpbpoBrQzNoWKjRBFV88fd7wUihi2Qc=; b=BE8k9W2C3h9zFbjXabjbr+kyO85vfEdrR2cW6GGY58F/dUQKkXOR2c5eu1cL4j6UvD /d+OoTIkmmSrFXnOvt2qW2Zg7G14uCTW7hEw/0tf1Z1I21qcHzQTRfNytYHOs70jSCOR aIwxJY2SFtYGhR+NGpIpqC1iO7xob1+bEgQ95Lkjnoe23x/I97PYFtxPWXMlo7xCWTxh zZHzNj424jMpqyRVwADHiQGROuPETd2wdzP0+ZbcnQcPsu9XH1UcIai4ZyfmynnkeA33 ssQYuPV/NGr/VZteXAJGgPpV1B0jKQYj04DQI2fsaZMW5tGRRq9Ac0AvH4NdRUFCRrsL B//g== X-Gm-Message-State: AO0yUKXHpgJEopsDa4UEw2J8r9jrs5XHrDHMPmH3e3oaR3tYGeVjVFvS PLQLOzTlmfp7RDj+N3Msp4WDBaagtgo= X-Google-Smtp-Source: AK7set9hy80yhziTOn3wgFU9CUlgc0skleSvABzW0WPwWlOlvBXOlcTunEo+b4Kwx8atuTza5zwJzg== X-Received: by 2002:a5d:4d47:0:b0:2bf:de97:f3f8 with SMTP id a7-20020a5d4d47000000b002bfde97f3f8mr9230469wru.28.1675443956225; Fri, 03 Feb 2023 09:05:56 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v1 1/4] xen: introduce CONFIG_GENERIC_BUG_FRAME Date: Fri, 3 Feb 2023 19:05:47 +0200 Message-Id: <8adf4aeff96750982e3d670cb3aed11553d546d5.1675441720.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 A large part of the content of the bug.h is repeated among all architectures, so it was decided to create a new config CONFIG_GENERIC_BUG_FRAME. The version of from ARM was taken as the base version, as it looks the most portable. The patch introduces the following stuff: * common bug.h header * generic implementation of do_bug_frame() * new config CONFIG_GENERIC_BUG_FRAME Signed-off-by: Oleksii Kurochko --- xen/common/Kconfig | 6 ++ xen/common/Makefile | 1 + xen/common/bug.c | 88 +++++++++++++++++++++++++++++ xen/include/xen/bug.h | 127 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 222 insertions(+) create mode 100644 xen/common/bug.c create mode 100644 xen/include/xen/bug.h diff --git a/xen/common/Kconfig b/xen/common/Kconfig index f1ea3199c8..811b4eaf3b 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -92,6 +92,12 @@ config STATIC_MEMORY If unsure, say N. +config GENERIC_DO_BUG_FRAME + bool + help + Generic do_bug_frame() function is needed to handle the type of bug + frame and print an information about it. + menu "Speculative hardening" config INDIRECT_THUNK diff --git a/xen/common/Makefile b/xen/common/Makefile index bbd75b4be6..7d04c8d3b2 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_ARGO) += argo.o obj-y += bitmap.o +obj-$(CONFIG_GENERIC_DO_BUG_FRAME) += bug.o obj-$(CONFIG_HYPFS_CONFIG) += config_data.o obj-$(CONFIG_CORE_PARKING) += core_parking.o obj-y += cpu.o diff --git a/xen/common/bug.c b/xen/common/bug.c new file mode 100644 index 0000000000..393e58d571 --- /dev/null +++ b/xen/common/bug.c @@ -0,0 +1,88 @@ +#include +#include +#include +#include +#include +#include + +#include + +int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) +{ + const struct bug_frame *bug = NULL; + const char *prefix = "", *filename, *predicate; + unsigned long fixup; + int id = -1, lineno; + const struct virtual_region *region; + + region = find_text_region(pc); + if ( region ) + { + for ( id = 0; id < BUGFRAME_NR; id++ ) + { + const struct bug_frame *b; + unsigned int i; + + for ( i = 0, b = region->frame[id].bugs; + i < region->frame[id].n_bugs; b++, i++ ) + { + if ( ((vaddr_t)bug_loc(b)) == pc ) + { + bug = b; + goto found; + } + } + } + } + found: + if ( !bug ) + return -ENOENT; + + if ( id == BUGFRAME_run_fn ) + { + void (*fn)(const struct cpu_user_regs *) = (void *)regs->BUG_FN_REG; + + fn(regs); + return 0; + } + + /* WARN, BUG or ASSERT: decode the filename pointer and line number. */ + filename = bug_file(bug); + if ( !is_kernel(filename) ) + return -EINVAL; + fixup = strlen(filename); + if ( fixup > 50 ) + { + filename += fixup - 47; + prefix = "..."; + } + lineno = bug_line(bug); + + switch ( id ) + { + case BUGFRAME_warn: + printk("Xen WARN at %s%s:%d\n", prefix, filename, lineno); + show_execution_state(regs); + return 0; + + case BUGFRAME_bug: + printk("Xen BUG at %s%s:%d\n", prefix, filename, lineno); + show_execution_state(regs); + panic("Xen BUG at %s%s:%d\n", prefix, filename, lineno); + + case BUGFRAME_assert: + /* ASSERT: decode the predicate string pointer. */ + predicate = bug_msg(bug); + if ( !is_kernel(predicate) ) + predicate = ""; + + printk("Assertion '%s' failed at %s%s:%d\n", + predicate, prefix, filename, lineno); + show_execution_state(regs); + panic("Assertion '%s' failed at %s%s:%d\n", + predicate, prefix, filename, lineno); + } + + return -EINVAL; +} + diff --git a/xen/include/xen/bug.h b/xen/include/xen/bug.h new file mode 100644 index 0000000000..b46dae035e --- /dev/null +++ b/xen/include/xen/bug.h @@ -0,0 +1,127 @@ +#ifndef __XEN_BUG_H__ +#define __XEN_BUG_H__ + +#define BUG_DISP_WIDTH 24 +#define BUG_LINE_LO_WIDTH (31 - BUG_DISP_WIDTH) +#define BUG_LINE_HI_WIDTH (31 - BUG_DISP_WIDTH) + +#define BUGFRAME_run_fn 0 +#define BUGFRAME_warn 1 +#define BUGFRAME_bug 2 +#define BUGFRAME_assert 3 + +#define BUGFRAME_NR 4 + +#ifndef __ASSEMBLY__ + +#include +#include +#include +#include + +#include + +#ifndef BUG_FRAME_STUFF +struct bug_frame { + signed int loc_disp; /* Relative address to the bug address */ + signed int file_disp; /* Relative address to the filename */ + signed int msg_disp; /* Relative address to the predicate (for ASSERT) */ + uint16_t line; /* Line number */ + uint32_t pad0:16; /* Padding for 8-bytes align */ +}; + +#define bug_loc(b) ((const void *)(b) + (b)->loc_disp) +#define bug_file(b) ((const void *)(b) + (b)->file_disp); +#define bug_line(b) ((b)->line) +#define bug_msg(b) ((const char *)(b) + (b)->msg_disp) +#endif /* BUG_FRAME_STUFF */ + +#ifndef BUG_FRAME +/* Many versions of GCC doesn't support the asm %c parameter which would + * be preferable to this unpleasantness. We use mergeable string + * sections to avoid multiple copies of the string appearing in the + * Xen image. BUGFRAME_run_fn needs to be handled separately. + */ +#define BUG_FRAME(type, line, file, has_msg, msg) do { \ + BUILD_BUG_ON((line) >> 16); \ + BUILD_BUG_ON((type) >= BUGFRAME_NR); \ + asm ("1:"BUG_INSTR"\n" \ + ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \ + "2:\t.asciz " __stringify(file) "\n" \ + "3:\n" \ + ".if " #has_msg "\n" \ + "\t.asciz " #msg "\n" \ + ".endif\n" \ + ".popsection\n" \ + ".pushsection .bug_frames." __stringify(type) ", \"a\", %progbits\n"\ + "4:\n" \ + ".p2align 2\n" \ + ".long (1b - 4b)\n" \ + ".long (2b - 4b)\n" \ + ".long (3b - 4b)\n" \ + ".hword " __stringify(line) ", 0\n" \ + ".popsection"); \ +} while (0) +#endif /* BUG_FRAME */ + +#ifndef run_in_exception_handler +/* + * GCC will not allow to use "i" when PIE is enabled (Xen doesn't set the + * flag but instead rely on the default value from the compiler). So the + * easiest way to implement run_in_exception_handler() is to pass the to + * be called function in a fixed register. + */ +#define run_in_exception_handler(fn) do { \ + register void *fn_ asm(__stringify(BUG_FN_REG)) = (fn); \ + asm ("1:"BUG_INSTR"\n" \ + ".pushsection .bug_frames." __stringify(BUGFRAME_run_fn) "," \ + " \"a\", %%progbits\n" \ + "2:\n" \ + ".p2align 2\n" \ + ".long (1b - 2b)\n" \ + ".long 0, 0, 0\n" \ + ".popsection" :: "r" (fn_)); \ +} while (0) +#endif /* run_in_exception_handler */ + +#ifndef WARN +#define WARN() BUG_FRAME(BUGFRAME_warn, __LINE__, __FILE__, 0, "") +#endif /* WARN */ + +#ifndef BUG +#define BUG() do { \ + BUG_FRAME(BUGFRAME_bug, __LINE__, __FILE__, 0, ""); \ + unreachable(); \ +} while (0) +#endif + +#ifndef assert_failed +#define assert_failed(msg) do { \ + BUG_FRAME(BUGFRAME_assert, __LINE__, __FILE__, 1, msg); \ + unreachable(); \ +} while (0) +#endif + +extern const struct bug_frame __start_bug_frames[], + __stop_bug_frames_0[], + __stop_bug_frames_1[], + __stop_bug_frames_2[], + __stop_bug_frames_3[]; + +#else /* !__ASSEMBLY__ */ + +#ifdef CONFIG_X86 +#include +#endif + +#endif /* __ASSEMBLY__ */ + +#endif /* __XEN_BUG_H__ */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ From patchwork Fri Feb 3 17:05:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13128113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88B84C6379F for ; Fri, 3 Feb 2023 17:06:35 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.489263.757639 (Exim 4.92) (envelope-from ) id 1pNzVj-0003Kw-SA; Fri, 03 Feb 2023 17:06:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 489263.757639; Fri, 03 Feb 2023 17:06:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pNzVj-0003Kp-ON; Fri, 03 Feb 2023 17:06:03 +0000 Received: by outflank-mailman (input) for mailman id 489263; Fri, 03 Feb 2023 17:06:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pNzVi-00033s-MK for xen-devel@lists.xenproject.org; Fri, 03 Feb 2023 17:06:02 +0000 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [2a00:1450:4864:20::32a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 073095ad-a3e5-11ed-93b5-47a8fe42b414; Fri, 03 Feb 2023 18:05:58 +0100 (CET) Received: by mail-wm1-x32a.google.com with SMTP id l37-20020a05600c1d2500b003dfe46a9801so2889349wms.0 for ; Fri, 03 Feb 2023 09:05:58 -0800 (PST) Received: from 34-6F-24-FC-D2-65.. (46.204.104.21.nat.umts.dynamic.t-mobile.pl. [46.204.104.21]) by smtp.gmail.com with ESMTPSA id f17-20020a5d50d1000000b002bfe266d710sm2452191wrt.90.2023.02.03.09.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 09:05:57 -0800 (PST) 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 Sender: "Xen-devel" X-Inumbo-ID: 073095ad-a3e5-11ed-93b5-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Yl1BVOCE2L2DuqGqY3o9frkeRbpNVy3JkjL/X/RKkSs=; b=Piz4Bo7P+4/3Xxe/fkI3O9MSoLBXHIF3aZpuXtMbi2ocnSrfxyQxuQ6K0TRkreS5eJ G4C5+7U2d4zK9SAC0LlyrjDhFdMBjiXz3mDn0wwaKDrJ0YpLIQQNHI6yb/0cfYOaADZ6 BHSR7s0rzNYdjkeMRjx/dubNEVRy+G7hEXxM42C4U4oRNwoFWBm7wIPjsai5UE0aPGae sTx1spuHjOmDUe1hFOlpF3p1wEXnBKtOecnNTEbslrdokyKF7N5CnX1D710B+h8QSU7O oeyQH1fv++UMGFgbdlOnTEOYBnENYP0oD0kzBeibCCVwSt0JC4QJVovgHstJqjE0ZlwR 2n9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yl1BVOCE2L2DuqGqY3o9frkeRbpNVy3JkjL/X/RKkSs=; b=7RkhqMf8B55OqjSFB+032jWvG7Z+pjLqcPArmse7uHNIxozVhVN7kHcfedXZD/jLR6 YiyZl7QCc6x8nfOhVaRpTztKnfzG19k4Bbf5To9uoYFlVH21Hesh7Z/YQ3K8BKjsbAyg 5Hfks/tSGODIQP16E/tNrBB2Pk6pR23DhcQdmAkZkf2V8Ep5FIHRO9+f4DUq0R/jbLfm sIqP6YgM1eQCTN/KQkxYPETChw/RBW2Jagp4ec5qQnh3741VJxnt7ME7yexMC4+F1QFw Fz6zzZd10+ufM5T92VxW6/aoL9bUV/7UDsBK29cCd4tuc+Fm8sTGwdh8yz1lx7m28Ibw kxtg== X-Gm-Message-State: AO0yUKVrMB3OfQkR5LrqZCWGc4ZCAjtEYEE1Y84WHeJMjegpJw5LPgzf p7ZxkXOaH+MCbRBHSYD5ozxojgv0vdQ= X-Google-Smtp-Source: AK7set8AcggySQAjlpRHEsrJ/C/bn0asYbjDxrZ9oNavZBTc+sBrfi7pove9NVnnr9v+kK3IjWvYEw== X-Received: by 2002:a05:600c:4687:b0:3db:eb0:6f6 with SMTP id p7-20020a05600c468700b003db0eb006f6mr10656252wmo.13.1675443957628; Fri, 03 Feb 2023 09:05:57 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH v1 2/4] xen/arm: switch ARM to use generic implementation of bug.h Date: Fri, 3 Feb 2023 19:05:48 +0200 Message-Id: <6c8b46f2f3326b833c73dbb86674ac5eb6ea45c8.1675441720.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Signed-off-by: Oleksii Kurochko --- xen/arch/arm/Kconfig | 1 + xen/arch/arm/include/asm/bug.h | 86 -------------------------------- xen/arch/arm/include/asm/div64.h | 2 +- xen/arch/arm/traps.c | 79 ----------------------------- xen/arch/arm/vgic/vgic-v2.c | 2 +- xen/arch/arm/vgic/vgic.c | 2 +- 6 files changed, 4 insertions(+), 168 deletions(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 239d3aed3c..ca622fc87d 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -18,6 +18,7 @@ config ARM select HAS_PDX select HAS_PMAP select IOMMU_FORCE_PT_SHARE + select GENERIC_DO_BUG_FRAME config ARCH_DEFCONFIG string diff --git a/xen/arch/arm/include/asm/bug.h b/xen/arch/arm/include/asm/bug.h index f4088d0913..841667411b 100644 --- a/xen/arch/arm/include/asm/bug.h +++ b/xen/arch/arm/include/asm/bug.h @@ -9,92 +9,6 @@ # error "unknown ARM variant" #endif -#define BUG_DISP_WIDTH 24 -#define BUG_LINE_LO_WIDTH (31 - BUG_DISP_WIDTH) -#define BUG_LINE_HI_WIDTH (31 - BUG_DISP_WIDTH) - -struct bug_frame { - signed int loc_disp; /* Relative address to the bug address */ - signed int file_disp; /* Relative address to the filename */ - signed int msg_disp; /* Relative address to the predicate (for ASSERT) */ - uint16_t line; /* Line number */ - uint32_t pad0:16; /* Padding for 8-bytes align */ -}; - -#define bug_loc(b) ((const void *)(b) + (b)->loc_disp) -#define bug_file(b) ((const void *)(b) + (b)->file_disp); -#define bug_line(b) ((b)->line) -#define bug_msg(b) ((const char *)(b) + (b)->msg_disp) - -#define BUGFRAME_run_fn 0 -#define BUGFRAME_warn 1 -#define BUGFRAME_bug 2 -#define BUGFRAME_assert 3 - -#define BUGFRAME_NR 4 - -/* Many versions of GCC doesn't support the asm %c parameter which would - * be preferable to this unpleasantness. We use mergeable string - * sections to avoid multiple copies of the string appearing in the - * Xen image. BUGFRAME_run_fn needs to be handled separately. - */ -#define BUG_FRAME(type, line, file, has_msg, msg) do { \ - BUILD_BUG_ON((line) >> 16); \ - BUILD_BUG_ON((type) >= BUGFRAME_NR); \ - asm ("1:"BUG_INSTR"\n" \ - ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \ - "2:\t.asciz " __stringify(file) "\n" \ - "3:\n" \ - ".if " #has_msg "\n" \ - "\t.asciz " #msg "\n" \ - ".endif\n" \ - ".popsection\n" \ - ".pushsection .bug_frames." __stringify(type) ", \"a\", %progbits\n"\ - "4:\n" \ - ".p2align 2\n" \ - ".long (1b - 4b)\n" \ - ".long (2b - 4b)\n" \ - ".long (3b - 4b)\n" \ - ".hword " __stringify(line) ", 0\n" \ - ".popsection"); \ -} while (0) - -/* - * GCC will not allow to use "i" when PIE is enabled (Xen doesn't set the - * flag but instead rely on the default value from the compiler). So the - * easiest way to implement run_in_exception_handler() is to pass the to - * be called function in a fixed register. - */ -#define run_in_exception_handler(fn) do { \ - asm ("mov " __stringify(BUG_FN_REG) ", %0\n" \ - "1:"BUG_INSTR"\n" \ - ".pushsection .bug_frames." __stringify(BUGFRAME_run_fn) "," \ - " \"a\", %%progbits\n" \ - "2:\n" \ - ".p2align 2\n" \ - ".long (1b - 2b)\n" \ - ".long 0, 0, 0\n" \ - ".popsection" :: "r" (fn) : __stringify(BUG_FN_REG) ); \ -} while (0) - -#define WARN() BUG_FRAME(BUGFRAME_warn, __LINE__, __FILE__, 0, "") - -#define BUG() do { \ - BUG_FRAME(BUGFRAME_bug, __LINE__, __FILE__, 0, ""); \ - unreachable(); \ -} while (0) - -#define assert_failed(msg) do { \ - BUG_FRAME(BUGFRAME_assert, __LINE__, __FILE__, 1, msg); \ - unreachable(); \ -} while (0) - -extern const struct bug_frame __start_bug_frames[], - __stop_bug_frames_0[], - __stop_bug_frames_1[], - __stop_bug_frames_2[], - __stop_bug_frames_3[]; - #endif /* __ARM_BUG_H__ */ /* * Local variables: diff --git a/xen/arch/arm/include/asm/div64.h b/xen/arch/arm/include/asm/div64.h index 1cd58bc51a..fc667a80f9 100644 --- a/xen/arch/arm/include/asm/div64.h +++ b/xen/arch/arm/include/asm/div64.h @@ -74,7 +74,7 @@ #elif __GNUC__ >= 4 -#include +#include /* * If the divisor happens to be constant, we determine the appropriate diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 061c92acbd..751c3277aa 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1197,85 +1197,6 @@ void do_unexpected_trap(const char *msg, const struct cpu_user_regs *regs) panic("CPU%d: Unexpected Trap: %s\n", smp_processor_id(), msg); } -int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) -{ - const struct bug_frame *bug = NULL; - const char *prefix = "", *filename, *predicate; - unsigned long fixup; - int id = -1, lineno; - const struct virtual_region *region; - - region = find_text_region(pc); - if ( region ) - { - for ( id = 0; id < BUGFRAME_NR; id++ ) - { - const struct bug_frame *b; - unsigned int i; - - for ( i = 0, b = region->frame[id].bugs; - i < region->frame[id].n_bugs; b++, i++ ) - { - if ( ((vaddr_t)bug_loc(b)) == pc ) - { - bug = b; - goto found; - } - } - } - } - found: - if ( !bug ) - return -ENOENT; - - if ( id == BUGFRAME_run_fn ) - { - void (*fn)(const struct cpu_user_regs *) = (void *)regs->BUG_FN_REG; - - fn(regs); - return 0; - } - - /* WARN, BUG or ASSERT: decode the filename pointer and line number. */ - filename = bug_file(bug); - if ( !is_kernel(filename) ) - return -EINVAL; - fixup = strlen(filename); - if ( fixup > 50 ) - { - filename += fixup - 47; - prefix = "..."; - } - lineno = bug_line(bug); - - switch ( id ) - { - case BUGFRAME_warn: - printk("Xen WARN at %s%s:%d\n", prefix, filename, lineno); - show_execution_state(regs); - return 0; - - case BUGFRAME_bug: - printk("Xen BUG at %s%s:%d\n", prefix, filename, lineno); - show_execution_state(regs); - panic("Xen BUG at %s%s:%d\n", prefix, filename, lineno); - - case BUGFRAME_assert: - /* ASSERT: decode the predicate string pointer. */ - predicate = bug_msg(bug); - if ( !is_kernel(predicate) ) - predicate = ""; - - printk("Assertion '%s' failed at %s%s:%d\n", - predicate, prefix, filename, lineno); - show_execution_state(regs); - panic("Assertion '%s' failed at %s%s:%d\n", - predicate, prefix, filename, lineno); - } - - return -EINVAL; -} - #ifdef CONFIG_ARM_64 static void do_trap_brk(struct cpu_user_regs *regs, const union hsr hsr) { diff --git a/xen/arch/arm/vgic/vgic-v2.c b/xen/arch/arm/vgic/vgic-v2.c index 1a99d3a8b4..c90e88fddb 100644 --- a/xen/arch/arm/vgic/vgic-v2.c +++ b/xen/arch/arm/vgic/vgic-v2.c @@ -16,8 +16,8 @@ */ #include -#include #include +#include #include #include diff --git a/xen/arch/arm/vgic/vgic.c b/xen/arch/arm/vgic/vgic.c index f0f2ea5021..b9463a5f27 100644 --- a/xen/arch/arm/vgic/vgic.c +++ b/xen/arch/arm/vgic/vgic.c @@ -15,9 +15,9 @@ * along with this program. If not, see . */ +#include #include #include -#include #include #include From patchwork Fri Feb 3 17:05:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13128112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B778C636D6 for ; Fri, 3 Feb 2023 17:06:35 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.489262.757628 (Exim 4.92) (envelope-from ) id 1pNzVh-000349-Jv; Fri, 03 Feb 2023 17:06:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 489262.757628; Fri, 03 Feb 2023 17:06:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pNzVh-000342-Gh; Fri, 03 Feb 2023 17:06:01 +0000 Received: by outflank-mailman (input) for mailman id 489262; Fri, 03 Feb 2023 17:06:00 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pNzVg-0002ZN-A2 for xen-devel@lists.xenproject.org; Fri, 03 Feb 2023 17:06:00 +0000 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [2a00:1450:4864:20::42b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0800783c-a3e5-11ed-933c-83870f6b2ba8; Fri, 03 Feb 2023 18:05:59 +0100 (CET) Received: by mail-wr1-x42b.google.com with SMTP id r2so5229174wrv.7 for ; Fri, 03 Feb 2023 09:05:59 -0800 (PST) Received: from 34-6F-24-FC-D2-65.. (46.204.104.21.nat.umts.dynamic.t-mobile.pl. [46.204.104.21]) by smtp.gmail.com with ESMTPSA id f17-20020a5d50d1000000b002bfe266d710sm2452191wrt.90.2023.02.03.09.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 09:05:58 -0800 (PST) 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 Sender: "Xen-devel" X-Inumbo-ID: 0800783c-a3e5-11ed-933c-83870f6b2ba8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GhdHtq9aMzFDWYNNkoxwJc2rej7B4EmE4MDh7V6MGV8=; b=PrsImFx6GNwYGrDks8LK0i6j0eUxCe9uSTX/pH59vscdE4b4pQIKcQKwk5h9gEAs8d Zcu539lmdUrWAhQsfPF6A6FnZZIKe2m58J5KmXqX+om83BNeZq1jBg3ueeU0J4Kyhqv3 LDX+SAkA6hHzZpBuOLqYYOVdzOeqSmNKtNovt3NXcSXLiK4pfPFQEOTxQumY4rPbkM27 xUHj1a9K6U6ujGGWqIIOwMYXFG9DElZH74wkPcFD2hB3lel/xiMDdHwrxZS7NYFMD01M VOJJ8Dm4+/2ypPrtaCwRD8ek5LqOTluvEaUYa4LeKTs0C9vzzSidQR22u1hPY2SzQPBl ZR0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GhdHtq9aMzFDWYNNkoxwJc2rej7B4EmE4MDh7V6MGV8=; b=FUeUx7oWzi4e7RA2vgrhkj8eyNIQFg/HJQiiQ1zn7tT+24i12kath352c7aPJew8XU gz/Nxdyz23p26w5V4GjZ+r82TBhmh03+rXVElf7t7f/GrPbKu1YeGRgQ5tQSOYZO8cV2 joSN024Tq3ABkBdVj8oIYlZhja+z5hAFC8YnRFD4rMwIvnjq9WnlgQcILsIENs23Y4M+ eqyzk6VjuwPeBNWZGbuT2tcMhn+PBU4yp/kOebJR0r3SDRj7qJUKuOVZkFwdUlIsnRhY FQCyioVxPTeYRdseq5KIHF60rGDNXraoX3VZ11DE8urDQy9CfuVHfAHtGbmPHCsq1X9k FRmw== X-Gm-Message-State: AO0yUKURYSb6HG7pf//Caxbb+sJIZwYfBoJ+F2z2GNOZxENHRoeJy2VZ wXWr/SIAR/WizwLwRlcfVe6k7+MLgyM= X-Google-Smtp-Source: AK7set/DvDfuwgbw5Ws3sN7u/z0yuAmf14cwE4Zew3Zh9a4qOin0v9FihyMezT6NyK9hlQVeCQjT6w== X-Received: by 2002:a5d:6309:0:b0:2c3:dc42:525d with SMTP id i9-20020a5d6309000000b002c3dc42525dmr152118wru.36.1675443958976; Fri, 03 Feb 2023 09:05:58 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v1 3/4] xen/x86: switch x86 to use generic implemetation of bug.h Date: Fri, 3 Feb 2023 19:05:49 +0200 Message-Id: X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Signed-off-by: Oleksii Kurochko --- xen/arch/x86/acpi/cpufreq/cpufreq.c | 2 +- xen/arch/x86/include/asm/asm_defns.h | 2 +- xen/arch/x86/include/asm/bug.h | 32 ++-------------------------- 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c index c27cbb2304..18ff2a443b 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -27,6 +27,7 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +#include #include #include #include @@ -35,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/include/asm/asm_defns.h b/xen/arch/x86/include/asm/asm_defns.h index d9431180cf..a8526cf36c 100644 --- a/xen/arch/x86/include/asm/asm_defns.h +++ b/xen/arch/x86/include/asm/asm_defns.h @@ -6,7 +6,7 @@ /* NB. Auto-generated from arch/.../asm-offsets.c */ #include #endif -#include +#include #include #include #include diff --git a/xen/arch/x86/include/asm/bug.h b/xen/arch/x86/include/asm/bug.h index b7265bdfbe..6ead21d9fe 100644 --- a/xen/arch/x86/include/asm/bug.h +++ b/xen/arch/x86/include/asm/bug.h @@ -1,19 +1,10 @@ #ifndef __X86_BUG_H__ #define __X86_BUG_H__ -#define BUG_DISP_WIDTH 24 -#define BUG_LINE_LO_WIDTH (31 - BUG_DISP_WIDTH) -#define BUG_LINE_HI_WIDTH (31 - BUG_DISP_WIDTH) - -#define BUGFRAME_run_fn 0 -#define BUGFRAME_warn 1 -#define BUGFRAME_bug 2 -#define BUGFRAME_assert 3 - -#define BUGFRAME_NR 4 - #ifndef __ASSEMBLY__ +#define BUG_FRAME_STUFF + struct bug_frame { signed int loc_disp:BUG_DISP_WIDTH; unsigned int line_hi:BUG_LINE_HI_WIDTH; @@ -58,13 +49,6 @@ struct bug_frame { :: _ASM_BUGFRAME_INFO(type, line, ptr, msg) ); \ } while (0) - -#define WARN() BUG_FRAME(BUGFRAME_warn, __LINE__, __FILE__, 0, NULL) -#define BUG() do { \ - BUG_FRAME(BUGFRAME_bug, __LINE__, __FILE__, 0, NULL); \ - unreachable(); \ -} while (0) - /* * TODO: untangle header dependences, break BUILD_BUG_ON() out of xen/lib.h, * and use a real static inline here to get proper type checking of fn(). @@ -75,19 +59,7 @@ struct bug_frame { BUG_FRAME(BUGFRAME_run_fn, 0, fn, 0, NULL); \ } while ( 0 ) -#define assert_failed(msg) do { \ - BUG_FRAME(BUGFRAME_assert, __LINE__, __FILE__, 1, msg); \ - unreachable(); \ -} while (0) - -extern const struct bug_frame __start_bug_frames[], - __stop_bug_frames_0[], - __stop_bug_frames_1[], - __stop_bug_frames_2[], - __stop_bug_frames_3[]; - #else /* !__ASSEMBLY__ */ - /* * Construct a bugframe, suitable for using in assembly code. Should always * match the C version above. One complication is having to stash the strings From patchwork Fri Feb 3 17:05:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13128109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C6CDC636D4 for ; Fri, 3 Feb 2023 17:06:34 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.489264.757643 (Exim 4.92) (envelope-from ) id 1pNzVk-0003OK-57; Fri, 03 Feb 2023 17:06:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 489264.757643; Fri, 03 Feb 2023 17:06:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pNzVk-0003NK-19; Fri, 03 Feb 2023 17:06:04 +0000 Received: by outflank-mailman (input) for mailman id 489264; Fri, 03 Feb 2023 17:06:03 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pNzVj-00033s-3b for xen-devel@lists.xenproject.org; Fri, 03 Feb 2023 17:06:03 +0000 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [2a00:1450:4864:20::42f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 08d59ef9-a3e5-11ed-93b5-47a8fe42b414; Fri, 03 Feb 2023 18:06:01 +0100 (CET) Received: by mail-wr1-x42f.google.com with SMTP id r27so1421583wrr.1 for ; Fri, 03 Feb 2023 09:06:01 -0800 (PST) Received: from 34-6F-24-FC-D2-65.. (46.204.104.21.nat.umts.dynamic.t-mobile.pl. [46.204.104.21]) by smtp.gmail.com with ESMTPSA id f17-20020a5d50d1000000b002bfe266d710sm2452191wrt.90.2023.02.03.09.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 09:06:00 -0800 (PST) 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 Sender: "Xen-devel" X-Inumbo-ID: 08d59ef9-a3e5-11ed-93b5-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zHXZzCaP4EL/Cp/TI2J6cwghMvNFDSnZkyTmGo7qoH0=; b=S+9fHGTuMOFzFjMfTsb2kTRx6sobp8yOt0pRw4mymhSu71QMs8DOVI8p0nTCctml2Y DJFZJF18GIrWI0BQaZGI5WHR4YvMWvXJUP7GOhMDFQfpov0XRGvz3Ldq1G1vt3jIW596 TD3EUtyJPWPaQaBtOv/89WZVCScohpgL7DQ6vY96ZnkM0urOKkrpWqHvhf34qBPnsPBG /h52f2mIdif5myuP4pCXlOGrufTR5dHmyiYK7IXGz0iKxlLx+K6IttedZUdA4nm1881c xOyAgyR5Uyoqq/6sl+PCUUHEt564shjXNF09yJfYvPQ3XjB/4AZw+wNAyQaK7QkRvlpw xcYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zHXZzCaP4EL/Cp/TI2J6cwghMvNFDSnZkyTmGo7qoH0=; b=JANsS+NKLxVmurJ0UvnkE08hYfxOL2U3J9PKoWvSKhaN4SUi9dEoc4VuQcqtL4OBDA c+46McKouX0F7fhDWRKXQl9Z3PaF07uT9rH4S78nDqv6+8/Zyv/O023i5aDseHOoWX5I 1GmvDOTWcI6uACKC1hXgsjel+MtgPkDI/b2vybUDKd0OfwMzASTn9bwtQE7rZ3a0xLqw yNeUK3fnmyBWZTCZUC+cItwxTtZDop60P3Ew53UHgQtgKWr8aeIPxsufNCLVUYu+w98W fop+6spUk82QeLL87i+vZuG8cyY5Mph+RZCHKRga44OzHPNp8LWI8qssqiMntPv20la7 LQ9w== X-Gm-Message-State: AO0yUKVH39+Hl6uJKTlA+akYne+ttk2iIau87jiZuBR3ElpipmUD34+0 ZM0OhLWlUSYOSpTVxNOa+Z4rPBwjYBw= X-Google-Smtp-Source: AK7set9OpICIjgWDA7IdAqXmFcZBD6zYoq//moBwyhuYa0DOPIeuf6b9f1wVD6gxwcI0z3wLeyr20A== X-Received: by 2002:adf:d0cc:0:b0:2bf:da4d:524 with SMTP id z12-20020adfd0cc000000b002bfda4d0524mr10467422wrh.35.1675443960437; Fri, 03 Feb 2023 09:06:00 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Jan Beulich , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v1 4/4] xen: change to Date: Fri, 3 Feb 2023 19:05:50 +0200 Message-Id: <5a427934949e3b0cf6026c8ad6c62e37e5250ca7.1675441720.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Since the generic version of bug.h stuff was introduced it is necessary to rename all uses of to Signed-off-by: Oleksii Kurochko --- xen/drivers/cpufreq/cpufreq.c | 2 +- xen/include/xen/lib.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c index a94520ee57..f290821a0e 100644 --- a/xen/drivers/cpufreq/cpufreq.c +++ b/xen/drivers/cpufreq/cpufreq.c @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 05ee1e18af..e914ccade0 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -24,12 +24,12 @@ #ifndef __ASSEMBLY__ +#include #include #include #include #include #include -#include #define BUG_ON(p) do { if (unlikely(p)) BUG(); } while (0) #define WARN_ON(p) ({ \