Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Feb 2001 07:10:20 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        ia64@FreeBSD.org
Subject:   Oh what the heck..
Message-ID:  <XFMail.010222071020.jhb@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Well, I figured that I'd try to fix switch_trampoline anyway.  I also needed to
remove all traces of sched_lock setting from cpu_switch() since that is now
done in mi_switch().  The end result is this patch.  I have no idea if it is
correct or not.  Comments?  (I still need to fix userret() to take a pointer to
a trapframe).

Index: swtch.s
===================================================================
RCS file: /usr/cvs/src/sys/ia64/ia64/swtch.s,v
retrieving revision 1.8
diff -u -r1.8 swtch.s
--- swtch.s     2001/02/22 13:29:22     1.8
+++ swtch.s     2001/02/22 15:04:47
@@ -205,14 +205,8 @@
        st8     [r17]=r18,8 ;;          // ar.bspstore
        st8     [r17]=r19,8 ;;          // our NaT bits
        st8     [r17]=r16,8 ;;          // ar.rnat
-       st8     [r17]=r20,8 ;;          // pr
+       st8     [r17]=r20 ;;            // pr
 
-       addl    r15=@ltoff(sched_lock),gp ;;
-       ld8     r15=[r15] ;;
-       add     r15=MTX_RECURSE,r15 ;;
-       ld4     r15=[r15] ;;
-       st8     [r17]=r15 ;;            // save sched_lock.mtx_recurse
-
        mov     ar.rsc=3                // turn RSE back on
 
        br.call.sptk.few rp=chooseproc
@@ -283,7 +277,7 @@
        ld8     r17=[r15],8 ;;          // ar.pfs
        ld8     r18=[r15],16 ;;         // ar.bspstore, skip ar.unat
        ld8     r19=[r15],8 ;;          // ar.rnat
-       ld8     r20=[r15],8 ;;          // pr
+       ld8     r20=[r15] ;;            // pr
 
        mov     ar.unat=r16
        mov     ar.pfs=r17
@@ -296,12 +290,6 @@
        mov     ar.rsc=3                // restart RSE
        invala
        ;;
-       ld8     r14=[r15]               // restore sched_lock.mtx_recurse
-       addl    r16=@ltoff(sched_lock),gp ;;
-       ld8     r15=[r16] ;;
-       add     r15=MTX_RECURSE,r15 ;;
-       st4     [r15]=r14
-
 9:
        br.ret.sptk.few rp
 
@@ -627,20 +615,23 @@
  * switch_trampoline()
  *
  * Arrange for a function to be invoked neatly, after a cpu_switch().
+ *
+ * Invokes fork_exit() passing in three arguments: a callout function, an
+ * argument to the callout, and a trapframe pointer.  For child processes
+ * returning from fork(2), the argument is a pointer to the child process.
  *
- * Invokes the function specified by the r4 register with the return
- * address specified by the r5 register and with one argument, taken
- * from r6.
+ * The callout function is in r4, the address to return to after executing
+ * fork_exit() is in r5, and the proc pointer is in r6.
  */
 ENTRY(switch_trampoline, 0)
-       MTX_EXIT(sched_lock, r14, r15)
-
-       alloc   r14=ar.pfs,0,0,1,0
-       mov     b7=r4
+       alloc   r14=ar.pfs,0,0,3,0
+       ;;
        mov     b0=r5
-       mov     out0=r6
+       mov     out0=r4
+       mov     out1=r6
+       mov     out2=sp
        ;;
-       br.call.sptk.few b6=b7
+       br.call.sptk.few b6=fork_exit
 
        END(switch_trampoline)
 

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ia64" in the body of the message




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