Allow context-switching within the MMU TLB miss handlers on SPARC64, and use this to implement MMU miss handlers in C rather
than assembler.
In order to allow OpenSolaris to boot under OpenBIOS, it is necessary to be able to invoke Forth words from within the MMU
I/D-TLB miss handlers, since Solaris 10 kernels hook into the virtual to physical address translation process via va>tte-data at
boot time. Hence this patch implements two macros: SAVE_CPU_STATE and RESTORE_CPU_STATE which enable a context switch to occur
from within these trap handlers.
Things are more complicated from within the MMU miss handlers because we can't use flushw to flush the processor registers to
stack. This is because the memory pointed to by the stack pointer may not be in the TLB either, and so we'd end up in a
recursive MMU trap. Hence we solve this by creating a static stack within OpenBIOS which is guaranteed to be locked in the TLB
and storing all of our state there.
Once the ability to switch context has been implemented, it is possible to invoke C functions as per normal from within the MMU
miss handlers. Hence as a proof of concept I've migrated the MMU miss handling code from ASM to C with a view of making the
relevant changes to invoke the relevant Forth functions at a later date.
I'd also like to say thank you to Blue Swirl who took the time to answer all my questions and generally point out the
shortcomings in my first attempts at SPARC assembler.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
git-svn-id: svn://openbios.org/openbios/trunk/openbios-devel@874 f158a5a8-5612-0410-a976-696ce0be7e32