Date: Wed, 26 Apr 2006 05:51:50 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96140 for review Message-ID: <200604260551.k3Q5poWt088492@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604260551.k3Q5poWt088492>