Re: V240 Status?

Martin Husemann <[email protected]>
Newsgroups gmane.os.netbsd.ports.sparc64
Message-ID <[email protected]>
This patch makes xcalls (and fss) work for me.

Takeshi, do you think you can make your version avoid the duplicate
softint bounce? Not that it likely matters at all.

I haven't made up my mind wich version we should prefer (as you probably
noticed).

Opinions?

Martin
diff (text/plain, 3.1 KB)
Index: mp_subr.S
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/mp_subr.S,v
retrieving revision 1.3
diff -u -p -r1.3 mp_subr.S
--- mp_subr.S	12 Jul 2011 07:51:34 -0000	1.3
+++ mp_subr.S	23 Jan 2013 14:01:58 -0000
@@ -410,22 +410,4 @@ ENTRY(sparc64_ipi_dcache_flush_page_us)
 	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
Index: locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/locore.s,v
retrieving revision 1.346
diff -u -p -r1.346 locore.s
--- locore.s	23 Jan 2013 12:19:02 -0000	1.346
+++ locore.s	23 Jan 2013 14:01:59 -0000
@@ -6283,6 +6283,67 @@ ENTRY(OF_val2sym32)
 #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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.