svn commit: r234114 - projects/amd64_xen_pv/sys/amd64/xen
Cherry G. Mathew
cherry at FreeBSD.org
Tue Apr 10 22:46:40 UTC 2012
Author: cherry
Date: Tue Apr 10 22:46:40 2012
New Revision: 234114
URL: http://svn.freebsd.org/changeset/base/234114
Log:
Reload the tls registers after the new GDT has been loaded.
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 Tue Apr 10 22:14:49 2012 (r234113)
+++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c Tue Apr 10 22:46:40 2012 (r234114)
@@ -276,7 +276,12 @@ initxen(struct start_info *si)
physmem = si->nr_pages;
Maxmem = si->nr_pages + 1;
- /* setup kernel tls registers. pcpu needs them */
+ /*
+ * Setup kernel tls registers. pcpu needs them, and other
+ * parts of the early startup path use pcpu variables before
+ * we have loaded the new Global Descriptor Table.
+ */
+
pc = &__pcpu[0];
HYPERVISOR_set_segment_base (SEGBASE_FS, 0);
HYPERVISOR_set_segment_base (SEGBASE_GS_KERNEL, (uint64_t) pc);
@@ -354,6 +359,14 @@ initxen(struct start_info *si)
lgdt(NULL); /* See: support.S */
+ /*
+ * Refresh kernel tls registers since we've blown them away
+ * via new GDT load. pcpu needs them.
+ */
+ HYPERVISOR_set_segment_base (SEGBASE_FS, 0);
+ HYPERVISOR_set_segment_base (SEGBASE_GS_KERNEL, (uint64_t) pc);
+ HYPERVISOR_set_segment_base (SEGBASE_GS_USER, (uint64_t) 0);
+
/* exception handling */
init_exception_table();
More information about the svn-src-projects
mailing list