I've been trying to get the evbmips port working on a new chip recently, and in the process I've tried building the kernel with PARANOIA enabled. This has resulted in a crash on startup, and I am wondering if it is surfacing a bug. Here is what's happening:
Some code under an #ifdef PARANOIA in cpu_switchto checks whether the IPL is IPL_SCHED, and if not, throws a trap. According to the manpage for cpu_switchto(9), the current IPL level being IPL_SCHED is a precondition for cpu_switchto(), so this check seems to make sense. The callstack looks like this:
cpu_switchto - this causes a trap when the check fails - manpage says IPL must be IPL_SCHED
mi_switch - manpage says IPL must be IPL_SCHED
yield - manpage doesn't say anything about IPL_SCHED, and IPL is not changed in this routine
main - doesn't appear to raise IPL before calling yield()
If I had to make a guess, it seems like yield() should be raising the IPL before calling mi_switch? I'm just starting to poke at the netbsd kernel a bit, so my apologies if any of this is obvious.
Thanks,
Alan