Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/arch/sparc64/sparc64 Pull up following revision(s) (r...



details:   https://anonhg.NetBSD.org/src/rev/ecce4720539d
branches:  netbsd-6
changeset: 775651:ecce4720539d
user:      riz <riz%NetBSD.org@localhost>
date:      Fri Feb 08 20:58:17 2013 +0000

description:
Pull up following revision(s) (requested by martin in ticket #797):
        sys/arch/sparc64/sparc64/locore.s: revision 1.347
        sys/arch/sparc64/sparc64/mp_subr.S: revision 1.4
Fix sparc64_ipi_ccall by adding proper trap setup.
Fixes xcall(9) problems, as exposed by pserialize(9). Noticed by
J. Hannken-Illjes, cause pointed out by Takeshi Nakayama.

diffstat:

 sys/arch/sparc64/sparc64/locore.s  |  63 +++++++++++++++++++++++++++++++++++++-
 sys/arch/sparc64/sparc64/mp_subr.S |  20 +-----------
 2 files changed, 63 insertions(+), 20 deletions(-)

diffs (109 lines):

diff -r 783f734c0920 -r ecce4720539d sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Fri Feb 08 20:51:55 2013 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Fri Feb 08 20:58:17 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.338.8.3 2012/11/23 16:12:36 riz Exp $     */
+/*     $NetBSD: locore.s,v 1.338.8.4 2013/02/08 20:58:17 riz Exp $     */
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -6302,6 +6302,67 @@
 #endif /* _LP64 */
 #endif /* DDB */
 
+
+#if defined(MULTIPROCESSOR)
+/*
+ * IPI target function to setup a C compatible environment and call a MI function.
+ *
+ * On entry:
+ *     We are on one of the alternate set of globals
+ *     %g2 = function to call
+ *     %g3 = single argument to called function
+ */
+ENTRY(sparc64_ipi_ccall)
+#ifdef TRAPS_USE_IG
+       wrpr    %g0, PSTATE_KERN|PSTATE_IG, %pstate     ! DEBUG
+#endif
+       TRAP_SETUP(-CC64FSZ-TF_SIZE)
+
+#ifdef DEBUG
+       rdpr    %tt, %o1        ! debug
+       sth     %o1, [%sp + CC64FSZ + STKB + TF_TT]! debug
+#endif
+       mov     %g3, %o0                        ! save argument of function to call
+       mov     %g2, %o5                        ! save function pointer
+
+       wrpr    %g0, PSTATE_KERN, %pstate       ! Get back to normal globals
+       stx     %g1, [%sp + CC64FSZ + STKB + TF_G + ( 1*8)]
+       mov     %g1, %o1                        ! code
+       rdpr    %tpc, %o2                       ! (pc)
+       stx     %g2, [%sp + CC64FSZ + STKB + TF_G + ( 2*8)]
+       rdpr    %tstate, %g1
+       stx     %g3, [%sp + CC64FSZ + STKB + TF_G + ( 3*8)]
+       rdpr    %tnpc, %o3
+       stx     %g4, [%sp + CC64FSZ + STKB + TF_G + ( 4*8)]
+       rd      %y, %o4
+       stx     %g5, [%sp + CC64FSZ + STKB + TF_G + ( 5*8)]
+       stx     %g6, [%sp + CC64FSZ + STKB + TF_G + ( 6*8)]
+       wrpr    %g0, 0, %tl                     ! return to tl=0
+       stx     %g7, [%sp + CC64FSZ + STKB + TF_G + ( 7*8)]
+
+       stx     %g1, [%sp + CC64FSZ + STKB + TF_TSTATE]
+       stx     %o2, [%sp + CC64FSZ + STKB + TF_PC]
+       stx     %o3, [%sp + CC64FSZ + STKB + TF_NPC]
+       st      %o4, [%sp + CC64FSZ + STKB + TF_Y]
+
+       rdpr    %pil, %g5
+       stb     %g5, [%sp + CC64FSZ + STKB + TF_PIL]
+       stb     %g5, [%sp + CC64FSZ + STKB + TF_OLDPIL]
+
+       !! In the EMBEDANY memory model %g4 points to the start of the data segment.
+       !! In our case we need to clear it before calling any C-code
+       clr     %g4
+       wr      %g0, ASI_NUCLEUS, %asi                  ! default kernel ASI
+
+       call %o5                                        ! call function
+        nop
+
+       ba,a    return_from_trap                        ! and return from IPI
+        nop
+
+#endif
+
+
        .data
        _ALIGN
 #if NKSYMS || defined(DDB) || defined(LKM)
diff -r 783f734c0920 -r ecce4720539d sys/arch/sparc64/sparc64/mp_subr.S
--- a/sys/arch/sparc64/sparc64/mp_subr.S        Fri Feb 08 20:51:55 2013 +0000
+++ b/sys/arch/sparc64/sparc64/mp_subr.S        Fri Feb 08 20:58:17 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mp_subr.S,v 1.3 2011/07/12 07:51:34 mrg Exp $  */
+/*     $NetBSD: mp_subr.S,v 1.3.8.1 2013/02/08 20:58:17 riz Exp $      */
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -410,22 +410,4 @@
        ba,a    ret_from_intr_vector
         nop
 
-/*
- * Setup a C compatible environment and call a MI function.
- *
- * On entry:
- *     %g2 = function to call
- *     %g3 = single argument to called function
- */
-ENTRY(sparc64_ipi_ccall)
-       save %sp, -CC64FSZ-16, %sp                      ! create a stack frame
-       stx %g2, [%fp + BIAS -16 + 0]                   ! save function pointer
-       stx %g3, [%fp + BIAS -16 + 8]                   ! and argument
-       wrpr    %g0, PSTATE_KERN, %pstate               ! switch globals
-       ldx [%fp + BIAS -16 + 0], %l0                   ! reload function
-       call %l0                                        ! call function
-        ldx [%fp + BIAS -16 + 8], %o0                  ! reload argument 
-       restore                                         ! pop stack frame
-       ba,a    ret_from_intr_vector                    ! and return from IPI
-        nop
 #endif



Home | Main Index | Thread Index | Old Index