Module Name: src Committed By: maxv Date: Sun Aug 27 08:38:32 UTC 2017
Modified Files: src/sys/arch/x86/include: cpu.h src/sys/arch/x86/x86: cpu.c Log Message: Localify. By the way, we should use a different stack for NMIs. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.132 -r1.133 src/sys/arch/x86/x86/cpu.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/x86/include/cpu.h diff -u src/sys/arch/x86/include/cpu.h:1.76 src/sys/arch/x86/include/cpu.h:1.77 --- src/sys/arch/x86/include/cpu.h:1.76 Sat Aug 12 07:21:57 2017 +++ src/sys/arch/x86/include/cpu.h Sun Aug 27 08:38:32 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.76 2017/08/12 07:21:57 maxv Exp $ */ +/* $NetBSD: cpu.h,v 1.77 2017/08/27 08:38:32 maxv Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -205,9 +205,6 @@ struct cpu_info { #endif /* __x86_64__ */ #endif /* XEN et.al */ - char *ci_doubleflt_stack; - char *ci_ddbipi_stack; - #ifndef XEN struct evcnt ci_ipi_events[X86_NIPI]; #else /* XEN */ Index: src/sys/arch/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.132 src/sys/arch/x86/x86/cpu.c:1.133 --- src/sys/arch/x86/x86/cpu.c:1.132 Fri Jul 28 14:12:26 2017 +++ src/sys/arch/x86/x86/cpu.c Sun Aug 27 08:38:32 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.132 2017/07/28 14:12:26 riastradh Exp $ */ +/* $NetBSD: cpu.c,v 1.133 2017/08/27 08:38:32 maxv Exp $ */ /*- * Copyright (c) 2000-2012 NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.132 2017/07/28 14:12:26 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.133 2017/08/27 08:38:32 maxv Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -977,14 +977,16 @@ static void cpu_set_tss_gates(struct cpu_info *ci) { struct segment_descriptor sd; + void *doubleflt_stack; - ci->ci_doubleflt_stack = (char *)uvm_km_alloc(kernel_map, USPACE, 0, + doubleflt_stack = (void *)uvm_km_alloc(kernel_map, USPACE, 0, UVM_KMF_WIRED); - tss_init(&ci->ci_doubleflt_tss, ci->ci_doubleflt_stack, - IDTVEC(tss_trap08)); + tss_init(&ci->ci_doubleflt_tss, doubleflt_stack, IDTVEC(tss_trap08)); + setsegment(&sd, &ci->ci_doubleflt_tss, sizeof(struct i386tss) - 1, SDT_SYS386TSS, SEL_KPL, 0, 0); ci->ci_gdt[GTRAPTSS_SEL].sd = sd; + setgate(&idt[8], NULL, 0, SDT_SYSTASKGT, SEL_KPL, GSEL(GTRAPTSS_SEL, SEL_KPL)); @@ -996,9 +998,11 @@ cpu_set_tss_gates(struct cpu_info *ci) * XXX overwriting the gate set in db_machine_init. * Should rearrange the code so that it's set only once. */ - ci->ci_ddbipi_stack = (char *)uvm_km_alloc(kernel_map, USPACE, 0, + void *ddbipi_stack; + + ddbipi_stack = (void *)uvm_km_alloc(kernel_map, USPACE, 0, UVM_KMF_WIRED); - tss_init(&ci->ci_ddbipi_tss, ci->ci_ddbipi_stack, + tss_init(&ci->ci_ddbipi_tss, ddbipi_stack, x2apic_mode ? Xx2apic_intrddbipi : Xintrddbipi); setsegment(&sd, &ci->ci_ddbipi_tss, sizeof(struct i386tss) - 1,