svn commit: r242415 - projects/amd64_xen_pv/sys/amd64/xen

Cherry G. Mathew cherry at FreeBSD.org
Wed Oct 31 21:27:16 UTC 2012


Author: cherry
Date: Wed Oct 31 21:27:15 2012
New Revision: 242415
URL: http://svn.freebsd.org/changeset/base/242415

Log:
  Align the kernel stack to 16 bytes, and notify Xen of our kernel %rsp
  
  Approved by: gibbs (implicit)

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

Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c
==============================================================================
--- projects/amd64_xen_pv/sys/amd64/xen/machdep.c	Wed Oct 31 21:24:31 2012	(r242414)
+++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c	Wed Oct 31 21:27:15 2012	(r242415)
@@ -534,13 +534,16 @@ initxen(struct start_info *si)
 	PCPU_SET(rsp0, (vm_offset_t) thread0.td_pcb & ~0xFul /* 16 byte aligned */);
 	PCPU_SET(curpcb, thread0.td_pcb);
 
+        HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), 
+		(unsigned long) PCPU_GET(rsp0)); /* Tell xen about the kernel stack */
+
 	/* setup user mode selector glue */
 	_ucodesel = GSEL(GUCODE_SEL, SEL_UPL);
 	_udatasel = GSEL(GUDATA_SEL, SEL_UPL);
 	_ufssel = GSEL(GUFS32_SEL, SEL_UPL);
 	_ugssel = GSEL(GUGS32_SEL, SEL_UPL);
 
-	return (u_int64_t) thread0.td_pcb;
+	return (u_int64_t) thread0.td_pcb  & ~0xFul /* 16 byte aligned */;
 }
 
 /*


More information about the svn-src-projects mailing list