svn commit: r258694 - head/sys/powerpc/ofw
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Wed Nov 27 21:51:34 UTC 2013
Author: nwhitehorn
Date: Wed Nov 27 21:51:34 2013
New Revision: 258694
URL: http://svnweb.freebsd.org/changeset/base/258694
Log:
Make RTAS calls, which call setfault() to recover from machine checks,
preserve any existing fault buffer. RTAS calls are meant to be safe from
interrupt context (and are indeed used there to implement the xics PIC
drvier). Without this, calling into RTAS in interrupt context would have
the effect of clearing any existing onfault state of the interrupted
thread, potentially leading to a panic.
Modified:
head/sys/powerpc/ofw/rtas.c
Modified: head/sys/powerpc/ofw/rtas.c
==============================================================================
--- head/sys/powerpc/ofw/rtas.c Wed Nov 27 20:56:10 2013 (r258693)
+++ head/sys/powerpc/ofw/rtas.c Wed Nov 27 21:51:34 2013 (r258694)
@@ -192,7 +192,7 @@ int
rtas_call_method(cell_t token, int nargs, int nreturns, ...)
{
vm_offset_t argsptr;
- faultbuf env;
+ faultbuf env, *oldfaultbuf;
va_list ap;
struct {
cell_t token;
@@ -221,6 +221,7 @@ rtas_call_method(cell_t token, int nargs
/* Get rid of any stale machine checks that have been waiting. */
__asm __volatile ("sync; isync");
+ oldfaultbuf = curthread->td_pcb->pcb_onfault;
if (!setfault(env)) {
__asm __volatile ("sync");
result = rtascall(argsptr, rtas_private_data);
@@ -228,7 +229,7 @@ rtas_call_method(cell_t token, int nargs
} else {
result = RTAS_HW_ERROR;
}
- curthread->td_pcb->pcb_onfault = 0;
+ curthread->td_pcb->pcb_onfault = oldfaultbuf;
__asm __volatile ("sync");
rtas_real_unmap(argsptr, &args, sizeof(args));
More information about the svn-src-head
mailing list