Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64/sparc64 sun4v: rtf_user now uses macros GET...



details:   https://anonhg.NetBSD.org/src/rev/332af7c358e0
branches:  trunk
changeset: 815814:332af7c358e0
user:      palle <palle%NetBSD.org@localhost>
date:      Sat Jun 04 21:24:41 2016 +0000

description:
sun4v: rtf_user now uses macros GET_MMU_CONTEXTID and SET_MMU_CONTEXTID. Tested on sun4u (QEMU) and sun4v (T2000). Parts from OpenBSD.

diffstat:

 sys/arch/sparc64/sparc64/locore.s |  38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r 07d39d1a41d4 -r 332af7c358e0 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Sat Jun 04 21:10:56 2016 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Sat Jun 04 21:24:41 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.397 2016/05/18 15:14:08 nakayama Exp $    */
+/*     $NetBSD: locore.s,v 1.398 2016/06/04 21:24:41 palle Exp $       */
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -150,6 +150,34 @@
 3:
        .endm
 
+       .macro  GET_MMU_CONTEXTID_SUN4U ctxid,ctx
+       ldxa    [\ctx] ASI_DMMU, \ctxid
+       .endm
+
+#ifdef SUN4V
+       .macro  GET_MMU_CONTEXTID_SUN4V ctxid,ctx
+       ldxa    [\ctx] ASI_MMU_CONTEXTID, \ctxid
+       .endm
+#endif 
+               
+       .macro  GET_MMU_CONTEXTID ctxid,ctx,scratch
+#ifdef SUN4V
+       sethi   %hi(cputyp), \scratch
+       ld      [\scratch + %lo(cputyp)], \scratch
+       cmp     \scratch, CPU_SUN4V
+       bne,pt  %icc, 2f
+        nop
+       /* sun4v */
+       GET_MMU_CONTEXTID_SUN4V \ctxid,\ctx
+       ba      3f
+        nop
+2:             
+#endif 
+       /* sun4u */
+       GET_MMU_CONTEXTID_SUN4U \ctxid,\ctx
+3:
+       .endm
+       
 #ifdef SUN4V
        .macro  NORMAL_GLOBALS_SUN4V
         wrpr   %g0, 0, %gl                             ! Set globals to level 0
@@ -4619,12 +4647,14 @@
        andn    %g1, CWP, %g1                   ! Clear it from %tstate
        wrpr    %g1, %g7, %tstate               ! Set %tstate with %cwp
 
-       wr      %g0, ASI_DMMU, %asi             ! restore the user context
-       ldxa    [CTX_SECONDARY] %asi, %g4
+       mov     CTX_SECONDARY, %g1              ! Restore the user context
+       GET_MMU_CONTEXTID %g4, %g1, %g3
+       mov     CTX_PRIMARY, %g2
+       SET_MMU_CONTEXTID %g4, %g2, %g3
        sethi   %hi(KERNBASE), %g7              ! Should not be needed due to retry
-       stxa    %g4, [CTX_PRIMARY] %asi
        membar  #Sync                           ! Should not be needed due to retry
        flush   %g7                             ! Should not be needed due to retry
+
        CLRTT
 #ifdef TRAPSTATS
        set     _C_LABEL(rftudone), %g1



Home | Main Index | Thread Index | Old Index