From owner-p4-projects@FreeBSD.ORG Wed Apr 26 05:51:51 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3636516A406; Wed, 26 Apr 2006 05:51:51 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1075A16A402 for ; Wed, 26 Apr 2006 05:51:51 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF22C43D45 for ; Wed, 26 Apr 2006 05:51:50 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3Q5podR088530 for ; Wed, 26 Apr 2006 05:51:50 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3Q5poWt088492 for perforce@freebsd.org; Wed, 26 Apr 2006 05:51:50 GMT (envelope-from kmacy@freebsd.org) Date: Wed, 26 Apr 2006 05:51:50 GMT Message-Id: <200604260551.k3Q5poWt088492@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 96140 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2006 05:51:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=96140 Change 96140 by kmacy@kmacy_storage:sun4v_rwbuf on 2006/04/26 05:51:11 atomically clear old PM_ACTIVE bit membar #Sync when setting secondary context Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/swtch.S#18 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/swtch.S#18 (text+ko) ==== @@ -39,6 +39,7 @@ .register %g3, #ignore #define PCB_REG %g6 + /* * void cpu_throw(struct thread *old, struct thread *new) */ @@ -55,10 +56,6 @@ ENTRY(cpu_switch) save %sp, -CCFSZ, %sp ldx [PCPU(CURPCB)], PCB_REG - - MAGIC_TRAP_ON - MAGIC_TRAP_OFF - mov %i1, %i0 /* @@ -101,6 +98,7 @@ stx %fp, [PCB_REG + PCB_SP] stx %i7, [PCB_REG + PCB_PC] + /* * Load the new thread's frame pointer and program counter, and set * the current thread and pcb. @@ -117,6 +115,7 @@ stx %g3, [%g1 + KTR_PARM3] 9: #endif + ldx [%i0 + TD_PCB], %i1 stx %i0, [PCPU(CURTHREAD)] @@ -152,7 +151,6 @@ cmp %l2, %i2 ! current pmap == new pmap? be,a,pn %xcc, 5f nop - ldx [%i2 + PM_CONTEXT], %l5 ! new context ldx [%l2 + PM_CONTEXT], %l3 ! old context cmp %g0, %l5 @@ -161,18 +159,24 @@ brz %l3, 10f ! old context == kernel? nop + /* * Mark the old pmap as no longer active on this CPU */ - lduw [%l2 + PM_ACTIVE], %l3 - andn %l3, %l4, %l3 - stw %l3, [%l2 + PM_ACTIVE] - + add %l2, PM_ACTIVE, %l2 + lduw [%l2], %l3 +8: andn %l3, %l4, %l6 + cas [%l2], %l3, %l6 + cmp %l3, %l6 + bne,pn %icc, 8b + mov %l3, %l6 + /* * Mark the new pmap as active on this CPU * XXX need to CAS */ -10: lduw [%i2 + PM_ACTIVE], %l3 +10: + lduw [%i2 + PM_ACTIVE], %l3 or %l3, %l4, %l3 stw %l3, [%i2 + PM_ACTIVE] @@ -214,7 +218,7 @@ */ SET_MMU_CONTEXT(%l6, %l5) - + membar #Sync /* * Done. Return and load the new process's window from the stack. */