Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Apr 2003 21:42:18 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 29328 for review
Message-ID:  <200304210442.h3L4gIfv075045@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=29328

Change 29328 by marcel@marcel_nfs on 2003/04/20 21:41:20

	Don't use the preserved registers to tell fork_trampoline what
	the callout function is and what its argument is. The preserved
	registers are sacred and using them is instant death (due to
	not preserving the values contained in the preserved registers
	on entry into the kernel). Use two scratch registers in the
	trapframe instead. r2 and r3 are "randomly" picked.

Affected files ...

.. //depot/projects/ia64_epc/sys/ia64/ia64/locore.s#14 edit
.. //depot/projects/ia64_epc/sys/ia64/ia64/vm_machdep.c#9 edit

Differences ...

==== //depot/projects/ia64_epc/sys/ia64/ia64/locore.s#14 (text+ko) ====

@@ -135,7 +135,8 @@
  * argument to the callout, and a trapframe pointer.  For child processes
  * returning from fork(2), the argument is a pointer to the child process.
  *
- * The callout function is in r4 and the argument is in r6.
+ * The callout function and its argument is in the trapframe in scratch
+ * registers r2 and r3.
  */
 ENTRY(fork_trampoline, 0)
 	.prologue
@@ -143,10 +144,15 @@
 	.body
 {	.mmi
 	alloc		r14=ar.pfs,0,0,3,0
-	mov		out0=r4
-	mov		out1=r6
+	add		r15=32+SIZEOF_SPECIAL+8,sp
+	add		r16=32+SIZEOF_SPECIAL+16,sp
 	;;
 }
+{	.mmi
+	ld8		out0=[r15]
+	ld8		out1=[r16]
+	nop		0
+}
 {	.mfb
 	add		out2=16,sp
 	nop		0

==== //depot/projects/ia64_epc/sys/ia64/ia64/vm_machdep.c#9 (text+ko) ====

@@ -202,8 +202,8 @@
 	void (*func)(void *);
 	void *arg;
 {
-	td->td_pcb->pcb_preserved.gr4 = (u_int64_t)func;
-	td->td_pcb->pcb_preserved.gr6 = (u_int64_t)arg;
+	td->td_frame->tf_scratch.gr2 = (u_int64_t)func;
+	td->td_frame->tf_scratch.gr3 = (u_int64_t)arg;
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304210442.h3L4gIfv075045>