PERFORCE change 80032 for review

Peter Wemm peter at FreeBSD.org
Tue Jul 12 00:27:46 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=80032

Change 80032 by peter at peter_daintree on 2005/07/12 00:27:39

	Allocate a stack for handling a double fault and set it on the AP's

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#102 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#102 (text+ko) ====

@@ -95,6 +95,9 @@
 /* Free these after use */
 void *bootstacks[MAXCPU];
 
+/* Temporary holder for double fault stack */
+char *doublefault_stack;
+
 /* Hotwire a 0->4MB V==P mapping */
 extern pt_entry_t *KPTphys;
 
@@ -432,7 +435,7 @@
 	common_tss[cpu] = common_tss[0];
 	common_tss[cpu].tss_rsp0 = 0;   /* not used until after switch */
 	common_tss[cpu].tss_iobase = sizeof(struct amd64tss);
-	/* XXX set tss_ist1 so we have a stack for a double fault */
+	common_tss[cpu].tss_ist1 = (long)&doublefault_stack[PAGE_SIZE];
 
 	gdt_segs[GPROC0_SEL].ssd_base = (long) &common_tss[cpu];
 	ssdtosyssd(&gdt_segs[GPROC0_SEL],
@@ -680,7 +683,8 @@
 		cpu_apic_ids[cpu] = apic_id;
 
 		/* allocate and set up an idle stack data page */
-		bootstacks[cpu] = (char *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE);
+		bootstacks[cpu] = kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE);
+		doublefault_stack = kmem_alloc(kernel_map, PAGE_SIZE);
 
 		bootSTK = (char *)bootstacks[cpu] + KSTACK_PAGES * PAGE_SIZE - 8;
 		bootAP = cpu;


More information about the p4-projects mailing list