Mon Feb 7 06:41:08 2011 UTC ()
Fix inverted test.  cpu_setmcontext should return success. :)


(matt)
diff -r1.2 -r1.3 src/sys/arch/powerpc/booke/trap.c

cvs diff -r1.2 -r1.3 src/sys/arch/powerpc/booke/trap.c (expand / switch to unified diff)

--- src/sys/arch/powerpc/booke/trap.c 2011/01/18 01:02:52 1.2
+++ src/sys/arch/powerpc/booke/trap.c 2011/02/07 06:41:08 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: trap.c,v 1.2 2011/01/18 01:02:52 matt Exp $ */ 1/* $NetBSD: trap.c,v 1.3 2011/02/07 06:41:08 matt Exp $ */
2/*- 2/*-
3 * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. 3 * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects 7 * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects
8 * Agency and which was developed by Matt Thomas of 3am Software Foundry. 8 * Agency and which was developed by Matt Thomas of 3am Software Foundry.
9 * 9 *
10 * This material is based upon work supported by the Defense Advanced Research 10 * This material is based upon work supported by the Defense Advanced Research
11 * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under 11 * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
12 * Contract No. N66001-09-C-2073. 12 * Contract No. N66001-09-C-2073.
13 * Approved for Public Release, Distribution Unlimited 13 * Approved for Public Release, Distribution Unlimited
14 * 14 *
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE. 34 * POSSIBILITY OF SUCH DAMAGE.
35 */ 35 */
36 36
37#include "opt_ddb.h" 37#include "opt_ddb.h"
38#include "opt_sa.h" 38#include "opt_sa.h"
39 39
40#include <sys/cdefs.h> 40#include <sys/cdefs.h>
41 41
42__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.2 2011/01/18 01:02:52 matt Exp $"); 42__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.3 2011/02/07 06:41:08 matt Exp $");
43 43
44#include <sys/param.h> 44#include <sys/param.h>
45#include <sys/systm.h> 45#include <sys/systm.h>
46#include <sys/siginfo.h> 46#include <sys/siginfo.h>
47#include <sys/lwp.h> 47#include <sys/lwp.h>
48#include <sys/proc.h> 48#include <sys/proc.h>
49#include <sys/cpu.h> 49#include <sys/cpu.h>
50#ifdef KERN_SA 50#ifdef KERN_SA
51#include <sys/savar.h> 51#include <sys/savar.h>
52#endif 52#endif
53#include <sys/kauth.h> 53#include <sys/kauth.h>
54#include <sys/kmem.h> 54#include <sys/kmem.h>
55#include <sys/ras.h> 55#include <sys/ras.h>
@@ -837,18 +837,18 @@ upcallret(struct lwp *l) @@ -837,18 +837,18 @@ upcallret(struct lwp *l)
837 mi_userret(l); /* Invoke MI userret code */ 837 mi_userret(l); /* Invoke MI userret code */
838}  838}
839 839
840/*  840/*
841 * Start a new LWP 841 * Start a new LWP
842 */ 842 */
843void 843void
844startlwp(void *arg) 844startlwp(void *arg)
845{ 845{
846 ucontext_t * const uc = arg; 846 ucontext_t * const uc = arg;
847 struct lwp * const l = curlwp; 847 struct lwp * const l = curlwp;
848 848
849 int error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags); 849 int error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
850 KASSERT(error); 850 KASSERT(error == 0);
851 (void)error; 851 (void)error;
852 kmem_free(uc, sizeof(ucontext_t));  852 kmem_free(uc, sizeof(ucontext_t));
853 upcallret(l); 853 upcallret(l);
854} 854}