From 84d7e08229b54ea597fda43d9e01516ce61bc3be Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Thu, 21 Jul 2005 21:46:09 +0000 Subject: [PATCH] Actually create the double fault stack page for AP cpus so that we have a chance of getting a working double fault instead of converting it to an instant triple fault reset. --- sys/amd64/amd64/mp_machdep.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 56d4c14ee714..a17114d2f7df 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -95,6 +95,9 @@ static int bootAP; /* 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,6 +435,7 @@ init_secondary(void) 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); + 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], @@ -679,7 +683,8 @@ start_all_aps(void) 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] = (void *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE); + doublefault_stack = (char *)kmem_alloc(kernel_map, PAGE_SIZE); bootSTK = (char *)bootstacks[cpu] + KSTACK_PAGES * PAGE_SIZE - 8; bootAP = cpu;