diff options
author | bde <bde@FreeBSD.org> | 2002-06-12 13:30:52 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2002-06-12 13:30:52 +0000 |
commit | a13cc2f243507c5ed2ac48dab854d86dae900d82 (patch) | |
tree | 03039cff840bd502e4df5f3212ccd9d6cc524f08 /sys | |
parent | 5a55cbe1ebf23653c6fd9a44d01909479c1609dd (diff) | |
download | FreeBSD-src-a13cc2f243507c5ed2ac48dab854d86dae900d82.zip FreeBSD-src-a13cc2f243507c5ed2ac48dab854d86dae900d82.tar.gz |
If trap() is called when ddb is active, then go directly to trap_fatal();
do not blunder around enabling interrupts and running trap handlers.
trap_pfault() will normally pass control to ddb's fault handler which
will normally do the right thing.
This bug is very old. but in old versions of FreeBSD it is probably only
serious for trap handling that involves sleeping. In -current, attempting
to examine unmapped memory while stopped at a breakpoint at mi_switch()
was always fatal.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/trap.c | 11 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 145d165..c14e837 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -190,6 +190,15 @@ trap(frame) #endif atomic_add_int(&cnt.v_trap, 1); + type = frame.tf_trapno; + +#ifdef DDB + if (db_active) { + eva = (type == T_PAGEFLT ? rcr2() : 0); + trap_fatal(&frame, eva); + goto out; + } +#endif if ((frame.tf_eflags & PSL_I) == 0) { /* @@ -199,7 +208,6 @@ trap(frame) * interrupts disabled until they are accidentally * enabled later. */ - type = frame.tf_trapno; if (ISPL(frame.tf_cs) == SEL_UPL || (frame.tf_eflags & PSL_VM)) printf( "pid %ld (%s): trap %d with interrupts disabled\n", @@ -222,7 +230,6 @@ trap(frame) } eva = 0; - type = frame.tf_trapno; code = frame.tf_err; if (type == T_PAGEFLT) { /* diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 145d165..c14e837 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -190,6 +190,15 @@ trap(frame) #endif atomic_add_int(&cnt.v_trap, 1); + type = frame.tf_trapno; + +#ifdef DDB + if (db_active) { + eva = (type == T_PAGEFLT ? rcr2() : 0); + trap_fatal(&frame, eva); + goto out; + } +#endif if ((frame.tf_eflags & PSL_I) == 0) { /* @@ -199,7 +208,6 @@ trap(frame) * interrupts disabled until they are accidentally * enabled later. */ - type = frame.tf_trapno; if (ISPL(frame.tf_cs) == SEL_UPL || (frame.tf_eflags & PSL_VM)) printf( "pid %ld (%s): trap %d with interrupts disabled\n", @@ -222,7 +230,6 @@ trap(frame) } eva = 0; - type = frame.tf_trapno; code = frame.tf_err; if (type == T_PAGEFLT) { /* |