Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2005 00:27:44 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 80032 for review
Message-ID:  <200507120027.j6C0RirF098761@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80032

Change 80032 by peter@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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507120027.j6C0RirF098761>