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.
This commit is contained in:
parent
cec48e002a
commit
1679c30254
@ -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, int nreturns, ...)
|
||||
|
||||
/* 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, int nreturns, ...)
|
||||
} 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));
|
||||
|
Loading…
Reference in New Issue
Block a user