Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Apr 2003 15:50:32 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 28571 for review
Message-ID:  <200304082250.h38MoWb1098485@repoman.freebsd.org>

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

Change 28571 by marcel@marcel_nfs on 2003/04/08 15:50:16

	Have savectx() return 0 and restorectx() return 1. That way
	we can swap contexts without actually having to create a
	swapctx() function, because we can write it like:
		if (!savectx(oldpcb))
			restorectx(newpcb);
	
	This pretty much behaves like setjmp()/longjmp() this way.
	
	The prime reason is that we have the right pmap installed
	when we save and restore the contexts.
	
	Keep swapctx() around for now in case things don't turn out
	the way I thought it would do.

Affected files ...

.. //depot/projects/ia64_epc/sys/ia64/ia64/context.s#7 edit
.. //depot/projects/ia64_epc/sys/ia64/ia64/machdep.c#7 edit
.. //depot/projects/ia64_epc/sys/ia64/include/pcb.h#5 edit

Differences ...

==== //depot/projects/ia64_epc/sys/ia64/ia64/context.s#7 (text+ko) ====

@@ -148,9 +148,12 @@
 	ldf.fill	f26=[r32],32
 	ldf.fill	f27=[r31],32
 	;;
+{	.mmi
 	ldf.fill	f28=[r32],32
 	ldf.fill	f29=[r31],32
+	add		r8=1,r0
 	;;
+}
 {	.mmb
 	ldf.fill	f30=[r32]
 	ldf.fill	f31=[r31]
@@ -284,9 +287,9 @@
 	stf.spill	[r31]=f29,32
 	stf.spill	[r32]=f30
 	;;
-{	.mfb
+{	.mib
 	stf.spill	[r31]=f31
-	nop		0
+(p15)	add		r8=0,r0
 (p15)	br.ret.sptk	rp
 	;;
 }

==== //depot/projects/ia64_epc/sys/ia64/ia64/machdep.c#7 (text+ko) ====

@@ -215,9 +215,11 @@
 
 	oldpcb = old->td_pcb;
 	oldpcb->pcb_current_pmap = PCPU_GET(current_pmap);
-	newpcb = new->td_pcb;
-	pmap_install(newpcb->pcb_current_pmap);
-	swapctx(oldpcb, newpcb);
+	if (!savectx(oldpcb)) {
+		newpcb = new->td_pcb;
+		pmap_install(newpcb->pcb_current_pmap);
+		restorectx(newpcb);
+	}
 }
 
 void

==== //depot/projects/ia64_epc/sys/ia64/include/pcb.h#5 (text+ko) ====

@@ -49,8 +49,8 @@
 };
 
 #ifdef _KERNEL
-void restorectx(struct pcb *);
-void savectx(struct pcb *);
+void restorectx(struct pcb *) __dead2;
+int savectx(struct pcb *);
 void swapctx(struct pcb *old, struct pcb *new);
 #endif
 



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