Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha/alpha Localize direct refernces to kernel sym...
details: https://anonhg.NetBSD.org/src/rev/833cd7aeae77
branches: trunk
changeset: 368588:833cd7aeae77
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Jul 20 17:03:10 2022 +0000
description:
Localize direct refernces to kernel symbols into functions. NFC.
diffstat:
sys/arch/alpha/alpha/db_trace.c | 43 +++++++++++++++++++++++++++++-----------
1 files changed, 31 insertions(+), 12 deletions(-)
diffs (93 lines):
diff -r f9e862897058 -r 833cd7aeae77 sys/arch/alpha/alpha/db_trace.c
--- a/sys/arch/alpha/alpha/db_trace.c Wed Jul 20 15:52:47 2022 +0000
+++ b/sys/arch/alpha/alpha/db_trace.c Wed Jul 20 17:03:10 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.30 2021/07/24 21:31:32 andvar Exp $ */
+/* $NetBSD: db_trace.c,v 1.31 2022/07/20 17:03:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.30 2021/07/24 21:31:32 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.31 2022/07/20 17:03:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -165,15 +165,38 @@
}
}
-static int
+static bool
sym_is_trapsymbol(vaddr_t v)
{
int i;
for (i = 0; special_symbols[i].ss_val != 0; ++i)
if (v == special_symbols[i].ss_val)
- return 1;
- return 0;
+ return true;
+ return false;
+}
+
+static bool
+sym_is_backstop(vaddr_t v)
+{
+ return v == (vaddr_t)&alpha_kthread_backstop;
+}
+
+static const char *
+trap_description(vaddr_t v)
+{
+ int i;
+
+ for (i = 0; special_symbols[i].ss_val != 0; ++i)
+ if (v == special_symbols[i].ss_val)
+ return special_symbols[i].ss_note;
+ return "(? trap ?)";
+}
+
+static bool
+trap_is_syscall(vaddr_t v)
+{
+ return v == (vaddr_t)&XentSys;
}
static void
@@ -191,7 +214,6 @@
struct prologue_info pi;
db_expr_t diff;
db_sym_t sym;
- int i;
u_long tfps;
const char *symname;
struct pcb *pcbp;
@@ -266,7 +288,7 @@
* backstop, then we are at the root of the call
* graph.
*/
- if (symval == (vaddr_t)&alpha_kthread_backstop) {
+ if (sym_is_backstop(symval)) {
(*pr)("--- kernel thread backstop ---\n");
break;
}
@@ -309,13 +331,10 @@
if (sym_is_trapsymbol(symval)) {
tf = (struct trapframe *)frame;
- for (i = 0; special_symbols[i].ss_val != 0; ++i)
- if (symval == special_symbols[i].ss_val)
- (*pr)("--- %s",
- special_symbols[i].ss_note);
+ (*pr)("--- %s", trap_description(symval));
tfps = tf->tf_regs[FRAME_PS];
- if (symval == (vaddr_t)&XentSys)
+ if (trap_is_syscall(symval))
decode_syscall(tf->tf_regs[FRAME_V0], p, pr);
if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) {
last_ipl = tfps & ALPHA_PSL_IPL_MASK;
Home |
Main Index |
Thread Index |
Old Index