From patchwork Wed Aug 18 20:29:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12445317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20362C4338F for ; Wed, 18 Aug 2021 20:30:22 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D7E92610D2 for ; Wed, 18 Aug 2021 20:30:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D7E92610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.168317.307328 (Exim 4.92) (envelope-from ) id 1mGSCH-0007Hw-OS; Wed, 18 Aug 2021 20:30:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 168317.307328; Wed, 18 Aug 2021 20:30: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 1mGSCH-0007Hn-LC; Wed, 18 Aug 2021 20:30:01 +0000 Received: by outflank-mailman (input) for mailman id 168317; Wed, 18 Aug 2021 20:29:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCF-000714-NG for xen-devel@lists.xenproject.org; Wed, 18 Aug 2021 20:29:59 +0000 Received: from mail-pl1-x633.google.com (unknown [2607:f8b0:4864:20::633]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5cd00804-05e6-4fea-bf0e-1e3d6a630f84; Wed, 18 Aug 2021 20:29:53 +0000 (UTC) Received: by mail-pl1-x633.google.com with SMTP id c17so2587564plz.2 for ; Wed, 18 Aug 2021 13:29:49 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id h25sm663775pfo.68.2021.08.18.13.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:29:47 -0700 (PDT) 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: 5cd00804-05e6-4fea-bf0e-1e3d6a630f84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ymbhtWJDlmnuoU0qSCptZumb6o8HnxQbmRZItmihOOU=; b=YKl9qr55piVM4v/UfO59fMR1wKRC2574LTWQNfSd0FVrL5nHh2bww1/I4V9aaHQ9cz KAd5HFzP5L4Dxy2z+xuudCCzeuW0RlCd/cqm7ze7zVCdRWUAp85G+CG1WWgLFxwwtxQS rbVym4zvigZQf+66xocGuApPV0F8WHaCnOhPkO8J1OvtmgahtqSMpjs9km4JEX6c/TvQ MebjS242u3bnJSG7uNbYzhEIkeT8OnIRPR5ha0ERS0ygDzyB4DFKsvWo0Z+O6VQjKbHd 471tzl/JVoe5wnVyrSHit6NKR9EB0PgF0eukJwkgPf9PTYYK2uZ6xwnBzCIIWZKqbohJ vurA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ymbhtWJDlmnuoU0qSCptZumb6o8HnxQbmRZItmihOOU=; b=RXl7A+w3zv4HYSYu8IXM4o5aLDhyUJNn8c5MhY5f8KKf/yok42zVlY9okh8/g8kE8r hYloOWLvWBxkkRdUZWiXx0WBxYu76s0vmGnAapRh8jTwSIYN4XNZ25xHpSlN4/XzdnzU XRCtsNcapQPcRmKHP0W1sgsfvLP875+/lqKukBolTAusiUW0gm+CIxP7KcZg5WKs5eEY pqayeEbKC5NoxWNux9NUImF9yyZOArIeMVykdZm1I73Y2PXb2OF+FjnaTCLikAFHzHwY x+0Fprq9/F6j4fKDMU8dkUYe7dWe2Q8FVhp92E0eXIFMSwznTDLxtqtcUZAjcgP82Icg zSig== X-Gm-Message-State: AOAM5328Fvm+WvdxLzd4lVg3xnnujavDz5gnIBwjqdnqLYs3/Q1IhMV1 WqLXOnK7+i6hNy8O56+sOWQASCmDAfLHrhRs X-Google-Smtp-Source: ABdhPJwg4IupZNg4wmzTylST1vPnBXDYpAFAsWlOW3tjWfPe3sReJbOfM6NM7rjPmc4Xs5AxlpgpQw== X-Received: by 2002:a17:902:7441:b029:12d:6476:d8f with SMTP id e1-20020a1709027441b029012d64760d8fmr8903237plt.28.1629318588212; Wed, 18 Aug 2021 13:29:48 -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_Pau_Monn=C3=A9?= , Wei Liu , Elena Ufimtseva , Jun Nakajima , Kevin Tian , George Dunlap , Ian Jackson Subject: [PATCH v3 1/6] arm/traps: remove debugger_trap_fatal() calls Date: Wed, 18 Aug 2021 13:29:02 -0700 Message-Id: <4c4f45280547564b2c16fd9ca09443314b8f3b6e.1629315873.git.bobby.eshleman@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 ARM doesn't actually use debugger_trap_* anything, and is stubbed out. This commit simply removes the unneeded calls. Signed-off-by: Bobby Eshleman Acked-by: Julien Grall --- xen/arch/arm/traps.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 4ccb6e7d18..889650ba63 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -1266,10 +1265,6 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) case BUGFRAME_bug: printk("Xen BUG at %s%s:%d\n", prefix, filename, lineno); - - if ( debugger_trap_fatal(TRAP_invalid_op, regs) ) - return 0; - show_execution_state(regs); panic("Xen BUG at %s%s:%d\n", prefix, filename, lineno); @@ -1281,8 +1276,6 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) printk("Assertion '%s' failed at %s%s:%d\n", predicate, prefix, filename, lineno); - if ( debugger_trap_fatal(TRAP_invalid_op, regs) ) - return 0; show_execution_state(regs); panic("Assertion '%s' failed at %s%s:%d\n", predicate, prefix, filename, lineno); From patchwork Wed Aug 18 20:29:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12445325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CCAEC4338F for ; Wed, 18 Aug 2021 20:30:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DEB4C610D2 for ; Wed, 18 Aug 2021 20:30:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DEB4C610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.168320.307361 (Exim 4.92) (envelope-from ) id 1mGSCW-0000fQ-OO; Wed, 18 Aug 2021 20:30:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 168320.307361; Wed, 18 Aug 2021 20:30:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCW-0000fH-Kc; Wed, 18 Aug 2021 20:30:16 +0000 Received: by outflank-mailman (input) for mailman id 168320; Wed, 18 Aug 2021 20:30:14 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCU-000714-Ne for xen-devel@lists.xenproject.org; Wed, 18 Aug 2021 20:30:14 +0000 Received: from mail-pj1-x102a.google.com (unknown [2607:f8b0:4864:20::102a]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d8baf436-6195-4e7d-9640-fac0d15dc35e; Wed, 18 Aug 2021 20:29:53 +0000 (UTC) Received: by mail-pj1-x102a.google.com with SMTP id hv22-20020a17090ae416b0290178c579e424so3183136pjb.3 for ; Wed, 18 Aug 2021 13:29:50 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id h25sm663775pfo.68.2021.08.18.13.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:29:49 -0700 (PDT) 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: d8baf436-6195-4e7d-9640-fac0d15dc35e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4ydItZe/YrS4x0wkLgFOI7vFRBemhJhfaF8p2sL58+8=; b=j69g3PiS+OxRuyXwjF6Adopqs6d6B5vsr8+HrrpIV+qi3sDt04QKnw8l3WamaXbl8P lFe9uwvk+CFaTSbfKh9I5t/ZACiU87LZJYsQReYVHbHhpPCa5Dmf+cqjrqzZbjIjPx84 y0cQ2HeRnAgmkSO/ld4sdqsp2QkNsU/5730BRWLuIlRo7WyiPErZjRRmIeemEtqpToqd /WGKvPoq9c8tz61cIK8W4H93byIz9PsXEvwGA2cBB8A6cTqydsB3pJQEJtTG4GI1f9JV 07jDQEFjyYJx4xeIRNNfRysHilXtnKXOI+Fem2W7C8str9dKkjdT6dWKM45aCcIW4CNb +zkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4ydItZe/YrS4x0wkLgFOI7vFRBemhJhfaF8p2sL58+8=; b=hyXY/shnDNo4KsczubLg1NzZO5yjflxE3liTgHDWDeAf6mvcNNLGcglwwCf+uy3eeD xML8QA2R0OON8NBpkbtBX6EJt4UQxIBLdIluMvMnhv2+X1F2BrsVo+44Nj5vAARATgGs zpR3kWpSLqfF1D6XKUWK1vCFvuK9Dz/ujIDUOT4/ZCNzijcKDlw5pd9n9qpKQrDMCc7a KIWEa3TDsk5xKzv/3uIt6dYNJpvxB3Udpu3A2zKmdLvMc8WhANHI3BnED/wLjm2AaE9A kPdk6qLOW7jFCIsfTfaTDa3GZd/rJtZfTOeN0XPfB25m/zafZcRDKkdopOpD8tpzPZx/ Tldw== X-Gm-Message-State: AOAM530YuttnDbN3JX9wf9AV16Rm8jVwEMtIWyUgKul5fmETXAiB3PKI S2DQERGljO4EiPDbFtKbehk6T1G15XM4pm2R X-Google-Smtp-Source: ABdhPJxM0yxuBeRAbA8LrpLo+klvMhi1bXn5XmaAsWbgMUvlPUn70NylvnbO/RZnS+q/ra6wqr4sSQ== X-Received: by 2002:a17:90a:9411:: with SMTP id r17mr11107155pjo.49.1629318589386; Wed, 18 Aug 2021 13:29:49 -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_Pau_Monn=C3=A9?= , Wei Liu , Elena Ufimtseva , Jun Nakajima , Kevin Tian , George Dunlap , Ian Jackson Subject: [PATCH v3 2/6] x86/debugger: separate Xen and guest debugging debugger_trap_* functions Date: Wed, 18 Aug 2021 13:29:03 -0700 Message-Id: <7925a89cf830e0e3705a8700fce09a408fcfc27c.1629315873.git.bobby.eshleman@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Unlike debugger_trap_fatal() and debugger_trap_immediate(), debugger_trap_entry() is specific to guest debugging and *NOT* the debugging of Xen itself. That is, it is part of gdbsx functionality and not the Xen gdstub. This is evidenced by debugger_trap_fatal()'s usage of domain_pause_for_debugger(). Because of this, debugger_trap_entry() does not belong alongside the generic Xen debugger functionality. This commit fixes this by expanding inline debugger_trap_entry() into its usage in x86/traps.c and stubbing out domain_pause_for_debugger() when !CONFIG_GDBSX. Properly placing what was debugger_trap_entry() under the scope of gdbsx instead of gdbstub. The function calls that caused an effective no-op and early exit out of debugger_trap_entry() are removed completely (when the trapnr is not int3/debug). This commit is one of a series geared towards removing the unnecessary requirement that all architectures to implement . Signed-off-by: Bobby Eshleman --- xen/arch/x86/domain.c | 2 +- xen/arch/x86/traps.c | 48 ++++++++++++++++++++-------------- xen/include/asm-x86/debugger.h | 42 ++--------------------------- 3 files changed, 31 insertions(+), 61 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index ef1812dc14..70894ff826 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -2541,7 +2541,7 @@ __initcall(init_vcpu_kick_softirq); void domain_pause_for_debugger(void) { -#ifdef CONFIG_CRASH_DEBUG +#ifdef CONFIG_GDBSX struct vcpu *curr = current; struct domain *d = curr->domain; diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index e60af16ddd..d0a4c0ea74 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -858,13 +858,20 @@ static void do_trap(struct cpu_user_regs *regs) if ( regs->error_code & X86_XEC_EXT ) goto hardware_trap; - if ( debugger_trap_entry(trapnr, regs) ) - return; - ASSERT(trapnr < 32); if ( guest_mode(regs) ) { + struct vcpu *curr = current; + if ( (trapnr == TRAP_debug || trapnr == TRAP_int3) && + guest_kernel_mode(curr, regs) && + curr->domain->debugger_attached ) + { + if ( trapnr != TRAP_debug ) + curr->arch.gdbsx_vcpu_event = trapnr; + domain_pause_for_debugger(); + return; + } pv_inject_hw_exception(trapnr, (TRAP_HAVE_EC & (1u << trapnr)) ? regs->error_code : X86_EVENT_NO_EC); @@ -1094,9 +1101,6 @@ void do_invalid_op(struct cpu_user_regs *regs) int id = -1, lineno; const struct virtual_region *region; - if ( debugger_trap_entry(TRAP_invalid_op, regs) ) - return; - if ( likely(guest_mode(regs)) ) { if ( pv_emulate_invalid_op(regs) ) @@ -1201,8 +1205,7 @@ void do_invalid_op(struct cpu_user_regs *regs) void do_int3(struct cpu_user_regs *regs) { - if ( debugger_trap_entry(TRAP_int3, regs) ) - return; + struct vcpu *curr = current; if ( !guest_mode(regs) ) { @@ -1215,6 +1218,12 @@ void do_int3(struct cpu_user_regs *regs) return; } + else if ( guest_kernel_mode(curr, regs) && curr->domain->debugger_attached ) + { + curr->arch.gdbsx_vcpu_event = TRAP_int3; + domain_pause_for_debugger(); + return; + } pv_inject_hw_exception(TRAP_int3, X86_EVENT_NO_EC); } @@ -1492,9 +1501,6 @@ void do_page_fault(struct cpu_user_regs *regs) /* fixup_page_fault() might change regs->error_code, so cache it here. */ error_code = regs->error_code; - if ( debugger_trap_entry(TRAP_page_fault, regs) ) - return; - perfc_incr(page_faults); /* Any shadow stack access fault is a bug in Xen. */ @@ -1593,9 +1599,6 @@ void do_general_protection(struct cpu_user_regs *regs) struct vcpu *v = current; #endif - if ( debugger_trap_entry(TRAP_gp_fault, regs) ) - return; - if ( regs->error_code & X86_XEC_EXT ) goto hardware_gp; @@ -1888,9 +1891,6 @@ void do_debug(struct cpu_user_regs *regs) /* Stash dr6 as early as possible. */ dr6 = read_debugreg(6); - if ( debugger_trap_entry(TRAP_debug, regs) ) - return; - /* * At the time of writing (March 2018), on the subject of %dr6: * @@ -1994,6 +1994,11 @@ void do_debug(struct cpu_user_regs *regs) return; } + else if ( guest_kernel_mode(v, regs) && v->domain->debugger_attached ) + { + domain_pause_for_debugger(); + return; + } /* Save debug status register where guest OS can peek at it */ v->arch.dr6 |= (dr6 & ~X86_DR6_DEFAULT); @@ -2014,9 +2019,6 @@ void do_entry_CP(struct cpu_user_regs *regs) const char *err = "??"; unsigned int ec = regs->error_code; - if ( debugger_trap_entry(TRAP_debug, regs) ) - return; - /* Decode ec if possible */ if ( ec < ARRAY_SIZE(errors) && errors[ec][0] ) err = errors[ec]; @@ -2028,6 +2030,12 @@ void do_entry_CP(struct cpu_user_regs *regs) */ if ( guest_mode(regs) ) { + struct vcpu *curr = current; + if ( guest_kernel_mode(curr, regs) && curr->domain->debugger_attached ) + { + domain_pause_for_debugger(); + return; + } gprintk(XENLOG_ERR, "Hit #CP[%04x] in guest context %04x:%p\n", ec, regs->cs, _p(regs->rip)); ASSERT_UNREACHABLE(); diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index 99803bfd0c..cd6b9477f7 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -5,19 +5,12 @@ * * Each debugger should define two functions here: * - * 1. debugger_trap_entry(): - * Called at start of any synchronous fault or trap, before any other work - * is done. The idea is that if your debugger deliberately caused the trap - * (e.g. to implement breakpoints or data watchpoints) then you can take - * appropriate action and return a non-zero value to cause early exit from - * the trap function. - * - * 2. debugger_trap_fatal(): + * 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). * - * 3. debugger_trap_immediate(): + * 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 state * rather than the state which was in effect when we took the trap. @@ -49,31 +42,6 @@ static inline bool debugger_trap_fatal( /* Int3 is a trivial way to gather cpu_user_regs context. */ #define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ); -static inline bool debugger_trap_entry( - unsigned int vector, struct cpu_user_regs *regs) -{ - /* - * This function is called before any checks are made. Amongst other - * things, be aware that during early boot, current is not a safe pointer - * to follow. - */ - struct vcpu *v = current; - - if ( vector != TRAP_int3 && vector != TRAP_debug ) - return false; - - if ( guest_mode(regs) && guest_kernel_mode(v, regs) && - v->domain->debugger_attached ) - { - if ( vector != TRAP_debug ) /* domain pause is good enough */ - current->arch.gdbsx_vcpu_event = vector; - domain_pause_for_debugger(); - return true; - } - - return false; -} - #else static inline bool debugger_trap_fatal( @@ -84,12 +52,6 @@ static inline bool debugger_trap_fatal( #define debugger_trap_immediate() ((void)0) -static inline bool debugger_trap_entry( - unsigned int vector, struct cpu_user_regs *regs) -{ - return false; -} - #endif #ifdef CONFIG_GDBSX From patchwork Wed Aug 18 20:29:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12445323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBC7BC4320E for ; Wed, 18 Aug 2021 20:30:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8C916610D2 for ; Wed, 18 Aug 2021 20:30:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8C916610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.168319.307350 (Exim 4.92) (envelope-from ) id 1mGSCR-0000Dz-8x; Wed, 18 Aug 2021 20:30:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 168319.307350; Wed, 18 Aug 2021 20:30:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCR-0000Dq-58; Wed, 18 Aug 2021 20:30:11 +0000 Received: by outflank-mailman (input) for mailman id 168319; Wed, 18 Aug 2021 20:30:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCP-000714-Nd for xen-devel@lists.xenproject.org; Wed, 18 Aug 2021 20:30:09 +0000 Received: from mail-pf1-x435.google.com (unknown [2607:f8b0:4864:20::435]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bd9e6df9-4592-4715-ae5d-e603d1893426; Wed, 18 Aug 2021 20:29:53 +0000 (UTC) Received: by mail-pf1-x435.google.com with SMTP id 7so3368365pfl.10 for ; Wed, 18 Aug 2021 13:29:51 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id h25sm663775pfo.68.2021.08.18.13.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:29:50 -0700 (PDT) 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: bd9e6df9-4592-4715-ae5d-e603d1893426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8OBC9884kmwmCHY2iZR5n9BK6YWwg3ipAzzHcSbYvfU=; b=aYYTc19KeDyUYd0t94QMEaH6q9fhEci8qpdovRYZuUMY7fz+5XrpgsdGa9C7nQCexA WwQD17e3FIwPisFBSif8BvlJEa53NJD+W0uke4Z0OFQAO91yJwQ9hxN91eH3oxJiunYF EmVk0arSgSaNZn132JojeNDAPyPSnBHrbzkKvOYV66X2q1u4mTuPdXvHIquR3FlAKfZi fDNuIjfyVvypGwUSG109X7DP4Sr/XflCB8XafQiesYjaTJxE7bj/1HpjQkc8ZFo/2lgB WJwjELHXXXx52+w+LUrkPZBb/oHtDn+rEdFB5VL/w1MUNfcWw5mkeR9X3lqQCNCr4SES MfpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8OBC9884kmwmCHY2iZR5n9BK6YWwg3ipAzzHcSbYvfU=; b=LSfprd0VcePxPBBkhNBw6ZheCDE1IjqivtQ9tDcImFIJbJrSNuUOnq2av9wmvBjIqq kzL4uARwN6yooJki9/sDt+mrJFYCYxPNyVcx9+udr6KmT6leSu/802+SlwP+BjZjPhfm SnxNvzawueXBP2zfMhzvdZmjyNzF76HYxKiIPW8DrNZsW0MfOZowOF1e+q5zKrWFc+eu cAXWNfaNJorM2slsuCW+1rwjeEDyIivaHNPUITs6XibDC9d9qnWuy/LWpc3GZecmF8Ys lz2mRZWi0zLJJ8WeHferywNnH4mvhT0GcQYIsi0ek33aST4g9RxwOOVinvSnmJVw2fxh GhjQ== X-Gm-Message-State: AOAM532Ju/jEbU+13swPyB/sCQyZrzctuO4RfsIcIc1GjDyO74aeYgbp g5ox3wxBEnNP1nk3whpUmBPNLbZ56fuMJYoC X-Google-Smtp-Source: ABdhPJwQBPt96fqTcpLeTFg1kVF+kEHwh8L6sFdo5h44QFmLMKaVmZZz0ny+bibgDTMn7Z4TIvOTAA== X-Received: by 2002:a62:b615:0:b029:3e0:20c3:181c with SMTP id j21-20020a62b6150000b02903e020c3181cmr11199194pff.62.1629318590543; Wed, 18 Aug 2021 13:29:50 -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_Pau_Monn=C3=A9?= , Wei Liu , Elena Ufimtseva , Jun Nakajima , Kevin Tian , George Dunlap , Ian Jackson Subject: [PATCH v3 3/6] arch/x86: rename debug.c to gdbsx.c Date: Wed, 18 Aug 2021 13:29:04 -0700 Message-Id: <9ab53497cdd52e3aeaeff8079d934dcee94d6479.1629315873.git.bobby.eshleman@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 This commit renames debug.c to gdbsx.c to clarify its purpose. The function gdbsx_guest_mem_io() is moved from domctl.c to gdbsx.c. Although gdbsx_guest_mem_io() is conditionally removed from its single call site in domctl.c upon !CONFIG_GDBSX and so no stub is technically necessary, this commit adds a stub that would preserve the functioning of that call site if the #ifdef CONFIG_GDBSX were to ever be removed or the function were to ever be called outside of such an ifdef block. Signed-off-by: Bobby Eshleman --- xen/arch/x86/Makefile | 2 +- xen/arch/x86/domctl.c | 12 +----------- xen/arch/x86/{debug.c => gdbsx.c} | 12 ++++++++++-- xen/include/asm-x86/debugger.h | 6 ------ xen/include/asm-x86/gdbsx.h | 17 +++++++++++++++++ 5 files changed, 29 insertions(+), 20 deletions(-) rename xen/arch/x86/{debug.c => gdbsx.c} (93%) create mode 100644 xen/include/asm-x86/gdbsx.h diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index fe38cfd544..ef8c2c4770 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -20,7 +20,7 @@ obj-y += cpuid.o obj-$(CONFIG_PV) += compat.o obj-$(CONFIG_PV32) += x86_64/compat.o obj-$(CONFIG_KEXEC) += crash.o -obj-$(CONFIG_GDBSX) += debug.o +obj-$(CONFIG_GDBSX) += gdbsx.o obj-y += delay.o obj-y += desc.o obj-bin-y += dmi_scan.init.o diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 26a76d2be9..a492fe140e 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -33,20 +34,9 @@ #include #include #include -#include #include #include -#ifdef CONFIG_GDBSX -static int gdbsx_guest_mem_io(domid_t domid, struct xen_domctl_gdbsx_memio *iop) -{ - iop->remain = dbg_rw_mem(iop->gva, guest_handle_from_ptr(iop->uva, void), - iop->len, domid, iop->gwr, iop->pgd3val); - - return iop->remain ? -EFAULT : 0; -} -#endif - static int update_domain_cpu_policy(struct domain *d, xen_domctl_cpu_policy_t *xdpc) { diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/gdbsx.c similarity index 93% rename from xen/arch/x86/debug.c rename to xen/arch/x86/gdbsx.c index d90dc93056..adea0f017b 100644 --- a/xen/arch/x86/debug.c +++ b/xen/arch/x86/gdbsx.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include typedef unsigned long dbgva_t; @@ -158,7 +158,7 @@ static unsigned int dbg_rw_guest_mem(struct domain *dp, unsigned long addr, * pgd3: value of init_mm.pgd[3] in guest. see above. * Returns: number of bytes remaining to be copied. */ -unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf, +static unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf, unsigned int len, domid_t domid, bool toaddr, uint64_t pgd3) { @@ -174,6 +174,14 @@ unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf, return len; } +int gdbsx_guest_mem_io(domid_t domid, struct xen_domctl_gdbsx_memio *iop) +{ + iop->remain = dbg_rw_mem(iop->gva, guest_handle_from_ptr(iop->uva, void), + iop->len, domid, iop->gwr, iop->pgd3val); + + return iop->remain ? -EFAULT : 0; +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index cd6b9477f7..ed4d5c829b 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -54,10 +54,4 @@ static inline bool debugger_trap_fatal( #endif -#ifdef CONFIG_GDBSX -unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf, - unsigned int len, domid_t domid, bool toaddr, - uint64_t pgd3); -#endif - #endif /* __X86_DEBUGGER_H__ */ diff --git a/xen/include/asm-x86/gdbsx.h b/xen/include/asm-x86/gdbsx.h new file mode 100644 index 0000000000..2b8812881d --- /dev/null +++ b/xen/include/asm-x86/gdbsx.h @@ -0,0 +1,17 @@ +#ifndef __X86_GDBX_H +#define __X86_GDBX_H__ + +#ifdef CONFIG_GDBSX + +int gdbsx_guest_mem_io(domid_t domid, struct xen_domctl_gdbsx_memio *iop); + +#else + +static inline int gdbsx_guest_mem_io(domid_t domid, struct xen_domctl_gdbsx_memio *iop) +{ + return -EOPNOTSUPP; +} + +#endif + +#endif From patchwork Wed Aug 18 20:29:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12445319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E640C4320A for ; Wed, 18 Aug 2021 20:30:22 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 242AE610D2 for ; Wed, 18 Aug 2021 20:30:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 242AE610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.168318.307339 (Exim 4.92) (envelope-from ) id 1mGSCM-0008At-0v; Wed, 18 Aug 2021 20:30:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 168318.307339; Wed, 18 Aug 2021 20:30:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCL-0008AF-T6; Wed, 18 Aug 2021 20:30:05 +0000 Received: by outflank-mailman (input) for mailman id 168318; Wed, 18 Aug 2021 20:30:04 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCK-000714-NK for xen-devel@lists.xenproject.org; Wed, 18 Aug 2021 20:30:04 +0000 Received: from mail-pj1-x102f.google.com (unknown [2607:f8b0:4864:20::102f]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5c334995-aa2b-41b0-b629-96c1f8662ac2; Wed, 18 Aug 2021 20:29:53 +0000 (UTC) Received: by mail-pj1-x102f.google.com with SMTP id nt11so3443944pjb.2 for ; Wed, 18 Aug 2021 13:29:52 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id h25sm663775pfo.68.2021.08.18.13.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:29:51 -0700 (PDT) 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: 5c334995-aa2b-41b0-b629-96c1f8662ac2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6A7J2MNGpc3g2fahO1l/wGJcP/R6g3oAioBf+kBOMlo=; b=TIaHwSm0XnhYahj8GaB1Xwb09vEeyiF8cMGpgaPI5pCENrwZv15NKVYeS5yrbfe/g3 pao03g4UH6b01s6p3XCAduhPgjhXecwCQ3SkRjP+EeOFcYcRpNdQ/Pkfx74DNotveVYI szrEhUvnEHkFp6ws+5fO92c3b2JBsw3lRKtbjqEzvU3/jWHzpMKgJ/F+S4+H/Dm2nJoH P86R1ZvNKCv/qs2JmTx+DyXcPU0k2QEDueq3oKkCz061UHHKBSYirO669Qwng+zYAksI l2fRks4b5UWuYQXHOqHCnenQC1/tETW82eDTBbU3nS7D4iZnhQHsbwaZTO5kLL0uZhFT QONw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6A7J2MNGpc3g2fahO1l/wGJcP/R6g3oAioBf+kBOMlo=; b=ekw2aHuqY5jFhrzzgjz8c2eu9leAT8p1+sX9HCh9j32zsPPi4Hr62XtQkO4Kue9OAO vYwiW2maNu0eBCDR1I1GlaFhx8ZXohM5/XZaIGa08RCBXPpA45X/HXDOTrulCbb2xRFt d6KBaCrBGfYcItMBV98QabMP7gFB1I7sloLxNHEzDLwqFjrEN3bnE4Lr3NrJyYKS6k95 v2+Phe0kWLOovA/kqKWDQMHbabG4E22pKnPefaLAoo231r3o+FsmNidsEuJWuRxtCqXI oj8js0h8itVn5QklQEq1KMwhDUnXD0hHW8u9ctpixAxo2NmmSa7mH6EyHMHVrVP/0g3v diuw== X-Gm-Message-State: AOAM530r16Vo9cftkSx2+ufRZ359Lp/rVGDiQICoBC7fH0t4Z/IaEC/a dyfzu7bJapFubvMVqPsbDpOdLoK4QQ/C/mqF X-Google-Smtp-Source: ABdhPJzwVN4slvHZh/0lxPIPp6llJx7b+APPSfqEQ/liaQQZ3i+8umorV432PQ3DU6l7BbvSO70Zmg== X-Received: by 2002:a17:902:da8f:b0:12d:a688:83b7 with SMTP id j15-20020a170902da8f00b0012da68883b7mr8688450plx.56.1629318591638; Wed, 18 Aug 2021 13:29:51 -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_Pau_Monn=C3=A9?= , Wei Liu , Elena Ufimtseva , Jun Nakajima , Kevin Tian , George Dunlap , Ian Jackson Subject: [PATCH v3 4/6] x86/gdbsx: expand dbg_rw_mem() inline Date: Wed, 18 Aug 2021 13:29:05 -0700 Message-Id: <7833b4a327212ff0fc816d17f91fa09291d6afc2.1629315873.git.bobby.eshleman@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Because dbg_rw_mem() has only a single call site, this commit expands it inline. --- xen/arch/x86/gdbsx.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/gdbsx.c b/xen/arch/x86/gdbsx.c index adea0f017b..4cb8e042f9 100644 --- a/xen/arch/x86/gdbsx.c +++ b/xen/arch/x86/gdbsx.c @@ -151,33 +151,23 @@ static unsigned int dbg_rw_guest_mem(struct domain *dp, unsigned long addr, return len; } -/* - * addr is guest addr - * buf is debugger buffer. - * if toaddr, then addr = buf (write to addr), else buf = addr (rd from guest) - * pgd3: value of init_mm.pgd[3] in guest. see above. - * Returns: number of bytes remaining to be copied. - */ -static unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf, - unsigned int len, domid_t domid, bool toaddr, - uint64_t pgd3) +int gdbsx_guest_mem_io(domid_t domid, struct xen_domctl_gdbsx_memio *iop) { struct domain *d = rcu_lock_domain_by_id(domid); - if ( d ) + if ( d && !d->is_dying ) { - if ( !d->is_dying ) - len = dbg_rw_guest_mem(d, gva, buf, len, toaddr, pgd3); - rcu_unlock_domain(d); + iop->remain = dbg_rw_guest_mem( + d, iop->gva, guest_handle_from_ptr(iop->uva, void), + iop->len, domid, iop->pgd3val); + } + else + { + iop->remain = iop->len; } - return len; -} - -int gdbsx_guest_mem_io(domid_t domid, struct xen_domctl_gdbsx_memio *iop) -{ - iop->remain = dbg_rw_mem(iop->gva, guest_handle_from_ptr(iop->uva, void), - iop->len, domid, iop->gwr, iop->pgd3val); + if ( d ) + rcu_unlock_domain(d); return iop->remain ? -EFAULT : 0; } From patchwork Wed Aug 18 20:29:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12445327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7799EC4338F for ; Wed, 18 Aug 2021 20:30:35 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 26BC760ED3 for ; Wed, 18 Aug 2021 20:30:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 26BC760ED3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.168321.307371 (Exim 4.92) (envelope-from ) id 1mGSCc-0001Bv-1m; Wed, 18 Aug 2021 20:30:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 168321.307371; Wed, 18 Aug 2021 20:30:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCb-0001Bf-Tm; Wed, 18 Aug 2021 20:30:21 +0000 Received: by outflank-mailman (input) for mailman id 168321; Wed, 18 Aug 2021 20:30:19 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCZ-000714-Nh for xen-devel@lists.xenproject.org; Wed, 18 Aug 2021 20:30:19 +0000 Received: from mail-pj1-x102d.google.com (unknown [2607:f8b0:4864:20::102d]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4b4ced5a-6ba6-4eb0-9b8c-d2c76a4780f5; Wed, 18 Aug 2021 20:29:53 +0000 (UTC) Received: by mail-pj1-x102d.google.com with SMTP id u21-20020a17090a8915b02901782c36f543so9696745pjn.4 for ; Wed, 18 Aug 2021 13:29:53 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id h25sm663775pfo.68.2021.08.18.13.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:29:52 -0700 (PDT) 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: 4b4ced5a-6ba6-4eb0-9b8c-d2c76a4780f5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z/GxiSbRFRsqjM1uw03mp0aByMGfgJWL6sCEVLvY9yo=; b=bNEzNoBCcyoAK1vJiNoO6HYZYgkeQut06KAvfvniipuPqmYAuSX3Cd6uywd43bzgW1 uxyUVgpQ9iRUvGqM1Njd3e3imSRX8UQGMv8dj0xa7LqAb5Dv+tu/GJlTQFZTgAfjbBVK W9OGFmaBcGHaoaI3vfUxLASnezZUoizdlL8gbazgu6Pvj/yMMCwytSGemwO7q76XbF0e RPtcRGlQXfBLkN1jJgNiTMoRv6SUYSBH1B4YvQVtCV2joSU6yQ+FJYn8BDqSYjO8SbaJ +08okqvWmh1uGCMfpS9cYQ3fPyrBkLwPXDcE00F0v9uOQQ645j9j+sD0NnxTb4u1PuY3 rFZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=z/GxiSbRFRsqjM1uw03mp0aByMGfgJWL6sCEVLvY9yo=; b=ZKKg+Y92kDslhwMeCJr3zEhHWV01SQfBb52LZRPw9yZaGKO1jUYJAprwkhdiYwGGiU PCsYDIOw/l/2JAtn4Hs/yHYjJfjd4cPCfXl1n3UbE6EsbRN2ggGkWFbFUJhh9tSNZYa+ hF9CeWdJNcwnAZb0cLAIv+gS1y1IjaDFX5rYNe/wu1qIZ6DtKw3CwUo5ZoYcE/cfH+T0 6ER8j4AzDhFOLS+jLmI/ZWriOUgBZL4eJL0SGNtg0dZ8Iaexx3vHtTQpSuQg/0qDHBAE zsLM2vsdMJ+hGIf5NElOwvECS8JeBW86N53FrwYvSP0NS3o0NkCh5l7Cwqx2AOE6SnEU XXGQ== X-Gm-Message-State: AOAM530+TBsDwY3sBqf5ZiVURU/vcsQXiaVQwxtjyIW0AVAIBSlWe0eb LSkRNzoCBiJ8HdBSX0F7cFJu+w3NT/Dqlixz X-Google-Smtp-Source: ABdhPJyh8DtEMy3Xiuo3daM/gznTddwqFpWtrZ++XTnWJWygJ9AvtiEbJaNHC8p/5fDfXZ//jrPBKA== X-Received: by 2002:a17:902:c406:b0:12d:d0ff:4a9 with SMTP id k6-20020a170902c40600b0012dd0ff04a9mr8611113plk.65.1629318592746; Wed, 18 Aug 2021 13:29:52 -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_Pau_Monn=C3=A9?= , Wei Liu , Elena Ufimtseva , Jun Nakajima , Kevin Tian , George Dunlap , Ian Jackson Subject: [PATCH v3 5/6] arch/x86: move domain_pause_for_debugger() to domain.h Date: Wed, 18 Aug 2021 13:29:06 -0700 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 domain_pause_for_debugger() was previously in debugger.h. This commit moves it to domain.h because its implementation is in domain.c. Signed-off-by: Bobby Eshleman --- Changes in v3: - domain_pause_for_debugger() is now moved into debugger.h, not a new file debugger.c xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/hvm/vmx/realmode.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/nmi.c | 1 - xen/arch/x86/traps.c | 1 + xen/include/asm-x86/debugger.h | 2 -- xen/include/asm-x86/domain.h | 2 ++ 7 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 642a64b747..84448e496f 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/hvm/vmx/realmode.c b/xen/arch/x86/hvm/vmx/realmode.c index cc23afa788..5c4b1910a9 100644 --- a/xen/arch/x86/hvm/vmx/realmode.c +++ b/xen/arch/x86/hvm/vmx/realmode.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index e09b7e3af9..6fd59865c7 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -51,7 +52,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index ab94a96c4d..11d5f5a917 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index d0a4c0ea74..5947ed25d6 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index ed4d5c829b..8f6222956e 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -26,8 +26,6 @@ #include #include -void domain_pause_for_debugger(void); - #ifdef CONFIG_CRASH_DEBUG #include diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 92d54de0b9..de854b5bfa 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -672,6 +672,8 @@ void update_guest_memory_policy(struct vcpu *v, void domain_cpu_policy_changed(struct domain *d); +void domain_pause_for_debugger(void); + bool update_runstate_area(struct vcpu *); bool update_secondary_system_time(struct vcpu *, struct vcpu_time_info *); From patchwork Wed Aug 18 20:29:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 12445329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E7E8C4338F for ; Wed, 18 Aug 2021 20:30:45 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 16706610D2 for ; Wed, 18 Aug 2021 20:30:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 16706610D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.168323.307383 (Exim 4.92) (envelope-from ) id 1mGSCf-0001cD-Da; Wed, 18 Aug 2021 20:30:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 168323.307383; Wed, 18 Aug 2021 20:30:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCf-0001c2-8s; Wed, 18 Aug 2021 20:30:25 +0000 Received: by outflank-mailman (input) for mailman id 168323; Wed, 18 Aug 2021 20:30:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCe-000714-Nn for xen-devel@lists.xenproject.org; Wed, 18 Aug 2021 20:30:24 +0000 Received: from mail-pf1-x432.google.com (unknown [2607:f8b0:4864:20::432]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 987880ea-60b2-4804-8cff-7b21d3fb1597; Wed, 18 Aug 2021 20:29:55 +0000 (UTC) Received: by mail-pf1-x432.google.com with SMTP id 7so3368494pfl.10 for ; Wed, 18 Aug 2021 13:29:55 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id h25sm663775pfo.68.2021.08.18.13.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:29:53 -0700 (PDT) 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: 987880ea-60b2-4804-8cff-7b21d3fb1597 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mzhpzYQx8peh1hdfIxEJjNatsuoe8FeZa6ijWCK1xjE=; b=h4CssbkPRxoitKam7/BAJ4YSIkbQ5wgEJmqRDamJcE7VRRfD3gKOIrhe8dba7nvdcG JO/OTO50Hhffn4Umpq9ojl3V03aoRR1GNGIxxFq9zvKKj4mRLIimKh6SCJk4KwbIgT67 jg1h4NTO/yhv4RRs8TDmaogpTJx6qx8SV7ijUXV2UmX34ROA2Nvugc451XcdHP3zShf0 gdyLMDdgCehTZ4oNytgVAXoEo3NMB2lGpGW/fRzLDhPq/V+6xHB9mzSURLPWWeAtWUMm Isf6PRsLvjb3cKOacE8R4KxzyqDHnrPs/r0bEs25a371/Qnw6QqLu2WH7dGOLSWfGav+ qcDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mzhpzYQx8peh1hdfIxEJjNatsuoe8FeZa6ijWCK1xjE=; b=tJdtfGvHFiqW6y4EYvjPRHZY58ccai7zuQLGKBhq0A8AywChA5Q8JDiwBVc+O2KAjA jkb6/UswL/P48+UwrQaZfSf/6HANWbBh1RxXdlEHRgOGA0bp1DBKwtTQpMD401UljInV nfSvr8VB92OK85hsZN7/XqRS04litUXs7KGn9NW6cn6wa1bD8lfgU8dW29o5fwuYVGc2 xDD5951DC+X6o3AO7BHANUVUdQyH2Nk/ZIagP9UmiJ5CbHys60xQ+IABbkaWWbl+R1kk UtpfnV/FzvrVBnDB2W3vzhbmT3jcQpg9BblU6HvS6xKjl5ybXHFWSrURo6I7IILVjtU+ KhWA== X-Gm-Message-State: AOAM532WiHJAW4BiaA48KfEBQlYalERvmtilS1/pXZ3c+mN9QBdJOuld cK81hqMfz/YvWP2qR+jp+76wmnwt+E1aCWnd X-Google-Smtp-Source: ABdhPJzSC9bUuemsB4if7L49hfh2BOsBCLPEaZDrpMrX0BOd6P+1gfwEGSXAxdUsbBvPto83tIMMEQ== X-Received: by 2002:a62:87c5:0:b029:3b5:f90f:c2eb with SMTP id i188-20020a6287c50000b02903b5f90fc2ebmr11339383pfe.28.1629318594044; Wed, 18 Aug 2021 13:29:54 -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_Pau_Monn=C3=A9?= , Wei Liu , Elena Ufimtseva , Jun Nakajima , Kevin Tian , George Dunlap , Ian Jackson Subject: [PATCH v3 6/6] x86: change asm/debugger.h to xen/debugger.h Date: Wed, 18 Aug 2021 13:29:07 -0700 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 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 Acked-by: Julien Grall --- Changes in v3: - No longer introduces a fake TRAP_invalid_op for arm to consume, it is not necessary given the removal of the arm calls now precedes this patch. - Instead of defining prototypes that arch/ is expected to implement, this version simply #includes when CONFIG_CRASH_DEBUG. xen/arch/x86/traps.c | 2 +- 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(+), 36 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 5947ed25d6..a540f0832e 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -62,7 +63,6 @@ #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 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 @@ */ #include +#include #include #include #include @@ -20,7 +21,6 @@ #include #include #include -#include #include 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 /* 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 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" ); -#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..166fad9d2e --- /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 state + * 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 + +#include + +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__ */