Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/m68k/m68k Add a check to my last 'fix' which ensure...
details: https://anonhg.NetBSD.org/src/rev/e5aac671d72e
branches: trunk
changeset: 471605:e5aac671d72e
user: scw <scw%NetBSD.org@localhost>
date: Mon Apr 05 17:17:04 1999 +0000
description:
Add a check to my last 'fix' which ensures the fault really
did happen in kernel mode.
diffstat:
sys/arch/m68k/m68k/db_trace.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diffs (46 lines):
diff -r a273f0904676 -r e5aac671d72e sys/arch/m68k/m68k/db_trace.c
--- a/sys/arch/m68k/m68k/db_trace.c Mon Apr 05 15:00:28 1999 +0000
+++ b/sys/arch/m68k/m68k/db_trace.c Mon Apr 05 17:17:04 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.24 1999/04/04 11:33:02 scw Exp $ */
+/* $NetBSD: db_trace.c,v 1.25 1999/04/05 17:17:04 scw Exp $ */
/*
* Mach Operating System
@@ -98,6 +98,8 @@
#define get(addr, space) \
(db_get_value((db_addr_t)(addr), sizeof(int), FALSE))
+#define get16(addr, space) \
+ (db_get_value((db_addr_t)(addr), sizeof(u_short), FALSE))
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
@@ -551,12 +553,21 @@
* we lose.
*/
if ( strcmp("_trap", name) == 0 ) {
- /* Point to 'trap()'s argument list */
- regp = pos.k_fp + FR_SAVFP + 4;
- /* Step over the arguments to the frame structure */
- regp += (4 * 4) + offsetof(struct frame, f_pc);
- /* Get the PC at the time of the fault */
- fault_pc = get(regp, DSP);
+ int tfp;
+
+ /* Point to 'trap()'s 4th argument (frame structure) */
+ tfp = pos.k_fp + FR_SAVFP + 4 + (4 * 4);
+
+ /* Determine if fault was from kernel or user mode */
+ regp = tfp + offsetof(struct frame, f_sr);
+ if ( ! USERMODE(get16(regp, DSP)) ) {
+ /*
+ * Definitely a kernel mode fault,
+ * so get the PC at the time of the fault.
+ */
+ regp = tfp + offsetof(struct frame, f_pc);
+ fault_pc = get(regp, DSP);
+ }
} else
if ( fault_pc ) {
if ( strcmp("faultstkadj", name) == 0 ) {
Home |
Main Index |
Thread Index |
Old Index