svn commit: r249717 - in projects/amd64_xen_pv/sys/amd64: amd64 xen

Cherry G. Mathew cherry at FreeBSD.org
Sun Apr 21 07:48:39 UTC 2013


Author: cherry
Date: Sun Apr 21 07:48:38 2013
New Revision: 249717
URL: http://svnweb.freebsd.org/changeset/base/249717

Log:
  Use per thread kernel stacks rather than thread0's.
  
  Approved by: gibbs(implicit)

Modified:
  projects/amd64_xen_pv/sys/amd64/amd64/cpu_switch.S
  projects/amd64_xen_pv/sys/amd64/xen/machdep.c

Modified: projects/amd64_xen_pv/sys/amd64/amd64/cpu_switch.S
==============================================================================
--- projects/amd64_xen_pv/sys/amd64/amd64/cpu_switch.S	Sun Apr 21 06:46:41 2013	(r249716)
+++ projects/amd64_xen_pv/sys/amd64/amd64/cpu_switch.S	Sun Apr 21 07:48:38 2013	(r249717)
@@ -323,6 +323,12 @@ done_tss:
 	/* Update the TSS_RSP0 pointer for the next interrupt */
 	movq	%r8,COMMON_TSS_RSP0(%rdx)
 	movq	%rsi,PCPU(CURTHREAD)		/* into next thread */
+#ifdef XEN
+	pushq	%r8
+	movq	%r8, %rdi
+	callq	xen_set_proc
+	popq	%r8
+#endif
 #ifndef	XEN
 	/* Test if debug registers should be restored. */
 	testl	$PCB_DBREGS,PCB_FLAGS(%r8)
@@ -388,9 +394,10 @@ load_dr:
 	movq	%r11,%dr6
 	movq	%rax,%dr7
 	jmp	done_load_dr
-
+#endif 	/* !XEN */
 do_tss:	movq	%rdx,PCPU(TSSP)
 	movq	%rdx,%rcx
+#ifndef XEN	
 	movq	PCPU(TSS),%rax
 	movw	%cx,2(%rax)
 	shrq	$16,%rcx
@@ -402,18 +409,6 @@ do_tss:	movq	%rdx,PCPU(TSSP)
 	movb	$0x89,5(%rax)	/* unset busy */
 	movl	$TSSSEL,%eax
 	ltr	%ax
-#else
-do_tss:
-	pushq	%rsi
-	pushq	%rdx
-	pushq	%r8
-
-	movq	%r8, %rdi
-	callq	xen_set_proc
-
-	popq	%r8
-	popq	%rdx
-	popq	%rsi
 #endif 	/* !XEN */
 	jmp	done_tss
 	

Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c
==============================================================================
--- projects/amd64_xen_pv/sys/amd64/xen/machdep.c	Sun Apr 21 06:46:41 2013	(r249716)
+++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c	Sun Apr 21 07:48:38 2013	(r249717)
@@ -1343,7 +1343,7 @@ void
 xen_set_proc(struct pcb *newpcb)
 {
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), 
-		(unsigned long) PCPU_GET(rsp0));
+		(unsigned long) newpcb & ~0xFul);
 }
 
 char *console_page;


More information about the svn-src-projects mailing list