From 8551411525d93daf3691598348730aa0ae18e369 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 27 Mar 2009 10:08:14 -0700 Subject: [PATCH] Make the jg_tos_ok debug check amd64-specific only and fix compiler warnings. --- sys/kern/lwkt_thread.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sys/kern/lwkt_thread.c b/sys/kern/lwkt_thread.c index dde44a908e..53cfcf4318 100644 --- a/sys/kern/lwkt_thread.c +++ b/sys/kern/lwkt_thread.c @@ -96,22 +96,29 @@ extern void cpu_lwkt_restore(void); extern void cpu_kthread_restore(void); extern void cpu_idle_restore(void); -int +#ifdef __amd64__ + +static int jg_tos_ok(struct thread *td) { + void *tos; + int tos_ok; + if (td == NULL) { return 1; } KKASSERT(td->td_sp != NULL); - unsigned long tos = ((unsigned long *)td->td_sp)[0]; - int tos_ok = 0; - if ((tos == cpu_heavy_restore) || (tos == cpu_lwkt_restore) - || (tos == cpu_kthread_restore) || (tos == cpu_idle_restore)) { + tos = ((void **)td->td_sp)[0]; + tos_ok = 0; + if ((tos == cpu_heavy_restore) || (tos == cpu_lwkt_restore) || + (tos == cpu_kthread_restore) || (tos == cpu_idle_restore)) { tos_ok = 1; } return tos_ok; } +#endif + /* * We can make all thread ports use the spin backend instead of the thread * backend. This should only be set to debug the spin backend. @@ -760,7 +767,9 @@ using_idle_thread: #endif if (td != ntd) { ++switch_count; +#ifdef __amd64__ KKASSERT(jg_tos_ok(ntd)); +#endif td->td_switch(ntd); } /* NOTE: current cpu may have changed after switch */ -- 2.41.0