CVS commit: [cherry-xenmp] src/sys/arch/i386/i386

2011-08-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Aug  6 21:06:34 UTC 2011

Modified Files:
src/sys/arch/i386/i386 [cherry-xenmp]: machdep.c

Log Message:
Update cpu local GDT entries for TLS registers %gs and %fs


To generate a diff of this commit:
cvs rdiff -u -r1.702.2.2 -r1.702.2.3 src/sys/arch/i386/i386/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.702.2.2 src/sys/arch/i386/i386/machdep.c:1.702.2.3
--- src/sys/arch/i386/i386/machdep.c:1.702.2.2	Sun Jul 31 20:49:10 2011
+++ src/sys/arch/i386/i386/machdep.c	Sat Aug  6 21:06:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.702.2.2 2011/07/31 20:49:10 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.702.2.3 2011/08/06 21:06:34 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.702.2.2 2011/07/31 20:49:10 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.702.2.3 2011/08/06 21:06:34 cherry Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -560,6 +560,12 @@
 
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb->pcb_esp0);
 
+	/* Update TLS segment pointers */
+	update_descriptor(&ci->ci_gdt[GUFS_SEL],
+			  (union descriptor *) &pcb->pcb_fsd);
+	update_descriptor(&ci->ci_gdt[GUGS_SEL], 
+			  (union descriptor *) &pcb->pcb_gsd);
+
 	physop.cmd = PHYSDEVOP_SET_IOPL;
 	physop.u.set_iopl.iopl = pcb->pcb_iopl;
 	HYPERVISOR_physdev_op(&physop);



CVS commit: [cherry-xenmp] src/sys/arch/i386/i386

2011-08-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Aug  6 14:05:35 UTC 2011

Modified Files:
src/sys/arch/i386/i386 [cherry-xenmp]: gdt.c

Log Message:
gdtgrow() must extend the gdt size on all cpus, not just the primary


To generate a diff of this commit:
cvs rdiff -u -r1.50.10.1 -r1.50.10.2 src/sys/arch/i386/i386/gdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/gdt.c
diff -u src/sys/arch/i386/i386/gdt.c:1.50.10.1 src/sys/arch/i386/i386/gdt.c:1.50.10.2
--- src/sys/arch/i386/i386/gdt.c:1.50.10.1	Sun Jul 31 20:49:10 2011
+++ src/sys/arch/i386/i386/gdt.c	Sat Aug  6 14:05:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.50.10.1 2011/07/31 20:49:10 cherry Exp $	*/
+/*	$NetBSD: gdt.c,v 1.50.10.2 2011/08/06 14:05:35 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.50.10.1 2011/07/31 20:49:10 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.50.10.2 2011/08/06 14:05:35 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -266,15 +266,17 @@
 			gdt_size[which] = MINGDTSIZ;
 			new_len = gdt_size[which] * sizeof(gdt[0]);
 		}
-		for(va = (vaddr_t)(cpu_info_primary.ci_gdt) + old_len + max_len;
-		va < (vaddr_t)(cpu_info_primary.ci_gdt) + new_len + max_len;
-		va += PAGE_SIZE) {
-			while ((pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO))
-			== NULL) {
-uvm_wait("gdt_grow");
+		for (CPU_INFO_FOREACH(cii, ci)) {
+			for(va = (vaddr_t)(ci->ci_gdt) + old_len + max_len;
+			va < (vaddr_t)(ci->ci_gdt) + new_len + max_len;
+			va += PAGE_SIZE) {
+while ((pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO))
+   == NULL) {
+	uvm_wait("gdt_grow");
+}
+pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg),
+	   VM_PROT_READ | VM_PROT_WRITE, 0);
 			}
-			pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg),
-			VM_PROT_READ | VM_PROT_WRITE, 0);
 		}
 		return;
 	}