All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>
Subject: [PATCH v5 5/6] x86/debugger: Misc cleanup prior to splitting
Date: Wed, 20 Apr 2022 15:13:06 +0100	[thread overview]
Message-ID: <20220420141307.24153-6-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20220420141307.24153-1-andrew.cooper3@citrix.com>

 * Remove inappropriate semicolon from debugger_trap_immediate()
 * Try to explain what debugger_trap_fatal() is doing, and write it in a more
   legible way.
 * Drop unecessary includes.  This includes common/domain.c which doesn't use
   any debugger functionality, even prior to this cleaup.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>

v5:
 * New
---
 xen/arch/x86/include/asm/debugger.h | 17 +++++++++++------
 xen/common/domain.c                 |  1 -
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/include/asm/debugger.h b/xen/arch/x86/include/asm/debugger.h
index 9a3132356fd6..5bac2ee4c2a4 100644
--- a/xen/arch/x86/include/asm/debugger.h
+++ b/xen/arch/x86/include/asm/debugger.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /******************************************************************************
  * asm/debugger.h
  * 
@@ -22,23 +23,27 @@
 #ifndef __X86_DEBUGGER_H__
 #define __X86_DEBUGGER_H__
 
-#include <xen/sched.h>
-#include <asm/regs.h>
-#include <asm/processor.h>
-
 #ifdef CONFIG_CRASH_DEBUG
 
 #include <xen/gdbstub.h>
+#include <xen/stdbool.h>
+
+#include <asm/x86-defns.h>
 
+/* Returns true if GDB handled the trap, or it is surviveable. */
 static inline bool debugger_trap_fatal(
     unsigned int vector, struct cpu_user_regs *regs)
 {
     int rc = __trap_to_gdb(regs, vector);
-    return ((rc == 0) || (vector == TRAP_int3));
+
+    if ( rc == 0 )
+        return true;
+
+    return vector == X86_EXC_BP;
 }
 
 /* Int3 is a trivial way to gather cpu_user_regs context. */
-#define debugger_trap_immediate() __asm__ __volatile__ ( "int3" );
+#define debugger_trap_immediate() __asm__ __volatile__ ( "int3" )
 
 #else
 
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 351029f8b239..8d2c2a989708 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -33,7 +33,6 @@
 #include <xen/xenoprof.h>
 #include <xen/irq.h>
 #include <xen/argo.h>
-#include <asm/debugger.h>
 #include <asm/p2m.h>
 #include <asm/processor.h>
 #include <public/sched.h>
-- 
2.11.0



  parent reply	other threads:[~2022-04-20 14:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 14:13 [PATCH v5 0/6] Clean up common/arch split for debugger.h Andrew Cooper
2022-04-20 14:13 ` [PATCH v5 1/6] x86/debugger: Remove debugger_trap_entry() Andrew Cooper
2022-04-21 13:02   ` Jan Beulich
2022-04-21 17:23     ` Andrew Cooper
2022-04-22  7:27       ` Jan Beulich
2022-04-20 14:13 ` [PATCH v5 2/6] x86/gdbsx: Rename debug.c to gdbsx.c Andrew Cooper
2022-04-21 13:06   ` Jan Beulich
2022-04-21 17:29     ` Andrew Cooper
2022-04-25 13:40   ` Jan Beulich
2022-04-20 14:13 ` [PATCH v5 3/6] x86/gdbsx: Move domain_pause_for_debugger() into gdbsx Andrew Cooper
2022-04-21 13:08   ` Jan Beulich
2022-04-20 14:13 ` [PATCH v5 4/6] x86/gdbstub: Clean up includes Andrew Cooper
2022-04-21 13:09   ` Jan Beulich
2022-04-20 14:13 ` Andrew Cooper [this message]
2022-04-21 13:10   ` [PATCH v5 5/6] x86/debugger: Misc cleanup prior to splitting Jan Beulich
2022-04-20 14:13 ` [PATCH v5 6/6] xen: Split x86/debugger.h into common and arch specific parts Andrew Cooper
2022-04-21 13:12   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220420141307.24153-6-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.