diff options
author | Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com> | 2010-08-16 22:47:01 -0700 |
---|---|---|
committer | Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com> | 2010-08-16 22:47:01 -0700 |
commit | dfea898ab532c75e4d1426e0ff2cc5e0d67aa72f (patch) | |
tree | df8a7e4841ea530f91d50fc975a5ff9ee49841f3 | |
parent | 0b54b18c5d076675196c58712af460e4e28d9ae0 (diff) | |
download | illumos-joyent-dfea898ab532c75e4d1426e0ff2cc5e0d67aa72f.tar.gz |
6970888 panic BAD TRAP: type=d (#gp General protection) due to incorrect use of x86_featureset
-rw-r--r-- | usr/src/uts/i86pc/ml/cpr_wakecode.s | 2 | ||||
-rw-r--r-- | usr/src/uts/i86pc/ml/mpcore.s | 4 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/cpuid.c | 29 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/mlsetup.c | 2 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/mp_startup.c | 7 | ||||
-rw-r--r-- | usr/src/uts/intel/sys/x86_archext.h | 5 |
6 files changed, 15 insertions, 34 deletions
diff --git a/usr/src/uts/i86pc/ml/cpr_wakecode.s b/usr/src/uts/i86pc/ml/cpr_wakecode.s index 38540f699b..fc58cd5d2a 100644 --- a/usr/src/uts/i86pc/ml/cpr_wakecode.s +++ b/usr/src/uts/i86pc/ml/cpr_wakecode.s @@ -672,7 +672,7 @@ kernel_wc_code: * Before proceeding, enable usage of the page table NX bit if * that's how the page tables are set up. */ - bt $X86FSET_NX, x86_featureset + bt $X86FSET_NX, x86_featureset(%rip) jnc 1f movl $MSR_AMD_EFER, %ecx rdmsr diff --git a/usr/src/uts/i86pc/ml/mpcore.s b/usr/src/uts/i86pc/ml/mpcore.s index d3bfa14f86..3ff8aa9d6d 100644 --- a/usr/src/uts/i86pc/ml/mpcore.s +++ b/usr/src/uts/i86pc/ml/mpcore.s @@ -315,7 +315,7 @@ kernel_cs_code: * Before going any further, enable usage of page table NX bit if * that's how our page tables are set up. */ - bt $X86FSET_NX, x86_featureset + bt $X86FSET_NX, x86_featureset(%rip) jnc 1f movl $MSR_AMD_EFER, %ecx rdmsr @@ -568,7 +568,7 @@ kernel_cs_code: * Before going any further, enable usage of page table NX bit if * that's how our page tables are set up. */ - bt $X86FSET_NX, x86_featureset + bt $X86FSET_NX, x86_featureset(%rip) jnc 1f movl $MSR_AMD_EFER, %ecx rdmsr diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c index 19e505917d..1a472c9e93 100644 --- a/usr/src/uts/i86pc/os/cpuid.c +++ b/usr/src/uts/i86pc/os/cpuid.c @@ -48,8 +48,8 @@ #include <sys/pg.h> #include <sys/fp.h> #include <sys/controlregs.h> -#include <sys/auxv_386.h> #include <sys/bitmap.h> +#include <sys/auxv_386.h> #include <sys/memnode.h> #include <sys/pci_cfgspace.h> @@ -118,11 +118,9 @@ uint_t x86_clflush_size = 0; uint_t pentiumpro_bug4046376; uint_t pentiumpro_bug4064495; -#define NUM_X86_FEATURES 35 -void *x86_featureset; -ulong_t x86_featureset0[BT_SIZEOFMAP(NUM_X86_FEATURES)]; +uchar_t x86_featureset[BT_SIZEOFMAP(NUM_X86_FEATURES)]; -char *x86_feature_names[NUM_X86_FEATURES] = { +static char *x86_feature_names[NUM_X86_FEATURES] = { "lgpg", "tsc", "msr", @@ -159,18 +157,6 @@ char *x86_feature_names[NUM_X86_FEATURES] = { "xsave", "avx" }; -static void * -init_x86_featureset(void) -{ - return (kmem_zalloc(BT_SIZEOFMAP(NUM_X86_FEATURES), KM_SLEEP)); -} - -void -free_x86_featureset(void *featureset) -{ - kmem_free(featureset, BT_SIZEOFMAP(NUM_X86_FEATURES)); -} - boolean_t is_x86_feature(void *featureset, uint_t feature) { @@ -868,11 +854,10 @@ setup_xfem(void) xsave_bv_all = flags; } -void * -cpuid_pass1(cpu_t *cpu) +void +cpuid_pass1(cpu_t *cpu, uchar_t *featureset) { uint32_t mask_ecx, mask_edx; - void *featureset; struct cpuid_info *cpi; struct cpuid_regs *cp; int xcpuid; @@ -889,9 +874,6 @@ cpuid_pass1(cpu_t *cpu) if (cpu->cpu_id == 0) { if (cpu->cpu_m.mcpu_cpi == NULL) cpu->cpu_m.mcpu_cpi = &cpuid_info0; - featureset = x86_featureset0; - } else { - featureset = init_x86_featureset(); } add_x86_feature(featureset, X86FSET_CPUID); @@ -1588,7 +1570,6 @@ cpuid_pass1(cpu_t *cpu) pass1_done: cpi->cpi_pass = 1; - return (featureset); } /* diff --git a/usr/src/uts/i86pc/os/mlsetup.c b/usr/src/uts/i86pc/os/mlsetup.c index 8086b773fd..2f7e271c29 100644 --- a/usr/src/uts/i86pc/os/mlsetup.c +++ b/usr/src/uts/i86pc/os/mlsetup.c @@ -185,7 +185,7 @@ mlsetup(struct regs *rp) * want to set the feature bits to correspond to the feature * minimum) this value may be altered. */ - x86_featureset = cpuid_pass1(cpu[0]); + cpuid_pass1(cpu[0], x86_featureset); #if !defined(__xpv) diff --git a/usr/src/uts/i86pc/os/mp_startup.c b/usr/src/uts/i86pc/os/mp_startup.c index 2979ddb0fc..843c5ae73a 100644 --- a/usr/src/uts/i86pc/os/mp_startup.c +++ b/usr/src/uts/i86pc/os/mp_startup.c @@ -1605,7 +1605,7 @@ static void mp_startup_common(boolean_t boot) { cpu_t *cp = CPU; - void *new_x86_featureset; + uchar_t new_x86_featureset[BT_SIZEOFMAP(NUM_X86_FEATURES)]; extern void cpu_event_init_cpu(cpu_t *); /* @@ -1631,7 +1631,8 @@ mp_startup_common(boolean_t boot) */ (void) (*ap_mlsetup)(); - new_x86_featureset = cpuid_pass1(cp); + bzero(new_x86_featureset, BT_SIZEOFMAP(NUM_X86_FEATURES)); + cpuid_pass1(cp, new_x86_featureset); #ifndef __xpv /* @@ -1688,8 +1689,6 @@ mp_startup_common(boolean_t boot) is_x86_feature(new_x86_featureset, X86FSET_MWAIT)) panic("unsupported mixed cpu monitor/mwait support detected"); - free_x86_featureset(new_x86_featureset); - /* * We could be more sophisticated here, and just mark the CPU * as "faulted" but at this point we'll opt for the easier diff --git a/usr/src/uts/intel/sys/x86_archext.h b/usr/src/uts/intel/sys/x86_archext.h index fba9c6e896..383610bbee 100644 --- a/usr/src/uts/intel/sys/x86_archext.h +++ b/usr/src/uts/intel/sys/x86_archext.h @@ -585,7 +585,8 @@ extern "C" { #if defined(_KERNEL) || defined(_KMEMUSER) -extern void *x86_featureset; +#define NUM_X86_FEATURES 35 +extern uchar_t x86_featureset[]; extern void free_x86_featureset(void *featureset); extern boolean_t is_x86_feature(void *featureset, uint_t feature); @@ -687,7 +688,7 @@ struct cpuid_info; extern void setx86isalist(void); extern void cpuid_alloc_space(struct cpu *); extern void cpuid_free_space(struct cpu *); -extern void *cpuid_pass1(struct cpu *); +extern void cpuid_pass1(struct cpu *, uchar_t *); extern void cpuid_pass2(struct cpu *); extern void cpuid_pass3(struct cpu *); extern uint_t cpuid_pass4(struct cpu *); |