From owner-svn-src-all@FreeBSD.ORG Wed Nov 27 21:51:34 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5E25426; Wed, 27 Nov 2013 21:51:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B4EAE2D77; Wed, 27 Nov 2013 21:51:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rARLpYje056186; Wed, 27 Nov 2013 21:51:34 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rARLpY6b056185; Wed, 27 Nov 2013 21:51:34 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201311272151.rARLpY6b056185@svn.freebsd.org> From: Nathan Whitehorn Date: Wed, 27 Nov 2013 21:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258694 - head/sys/powerpc/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Nov 2013 21:51:34 -0000 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));