aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2008-03-10 03:16:51 +0000
committerJeff Roberson <jeff@FreeBSD.org>2008-03-10 03:16:51 +0000
commit8f93d79d0536fb19b3e3894d8c888fb3084e9aab (patch)
tree2b937253303819d1e5a6ff4ef53e6bd8cd4facb8 /sys
parent73daf66f4185d1278c91f4a5afd5f83b5cbfacca (diff)
downloadsrc-8f93d79d0536fb19b3e3894d8c888fb3084e9aab.tar.gz
src-8f93d79d0536fb19b3e3894d8c888fb3084e9aab.zip
- Handle kdb switch panics outside of mi_switch() to remove some instructions
from the common path and make the code more clear. Whether this has any impact on performance may depend on optimization levels. Sponsored by: Nokia
Notes
Notes: svn path=/head/; revision=177010
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_synch.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index ad13c2b47461..983d5a6347a9 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -365,6 +365,15 @@ wakeup_one(ident)
sleepq_release(ident);
}
+static void
+kdb_switch(void)
+{
+ thread_unlock(curthread);
+ kdb_backtrace();
+ kdb_reenter();
+ panic("%s: did not reenter debugger", __func__);
+}
+
/*
* The machine independent parts of context switching.
*/
@@ -394,12 +403,8 @@ mi_switch(int flags, struct thread *newtd)
/*
* Don't perform context switches from the debugger.
*/
- if (kdb_active) {
- thread_unlock(td);
- kdb_backtrace();
- kdb_reenter();
- panic("%s: did not reenter debugger", __func__);
- }
+ if (kdb_active)
+ kdb_switch();
if (flags & SW_VOL)
td->td_ru.ru_nvcsw++;
else