diff options
author | Luiz Souza <luiz@netgate.com> | 2018-02-21 14:26:37 -0300 |
---|---|---|
committer | Luiz Souza <luiz@netgate.com> | 2018-02-21 14:26:37 -0300 |
commit | c1ee180537f04875eccd8e9b3d630b73ad654b14 (patch) | |
tree | dc39f4926b363489ebed63757d4634367c717350 | |
parent | 4c9907d21517c211b27a3cf5b7a2a976623820cc (diff) | |
download | FreeBSD-src-c1ee180537f04875eccd8e9b3d630b73ad654b14.zip FreeBSD-src-c1ee180537f04875eccd8e9b3d630b73ad654b14.tar.gz |
Revert "MFC r327818:"
This reverts commit ba6ece08e939b4f3d25e9e81956e8d622ed1fc2e.
-rw-r--r-- | sys/amd64/amd64/machdep.c | 27 | ||||
-rw-r--r-- | sys/amd64/amd64/mp_machdep.c | 14 | ||||
-rw-r--r-- | sys/amd64/include/md_var.h | 1 |
3 files changed, 22 insertions, 20 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 3ed29e0..a0d34f0 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1523,22 +1523,6 @@ amd64_kdb_init(void) #endif } -/* Set up the fast syscall stuff */ -void -amd64_conf_fast_syscall(void) -{ - uint64_t msr; - - msr = rdmsr(MSR_EFER) | EFER_SCE; - wrmsr(MSR_EFER, msr); - wrmsr(MSR_LSTAR, (u_int64_t)IDTVEC(fast_syscall)); - wrmsr(MSR_CSTAR, (u_int64_t)IDTVEC(fast_syscall32)); - msr = ((u_int64_t)GSEL(GCODE_SEL, SEL_KPL) << 32) | - ((u_int64_t)GSEL(GUCODE32_SEL, SEL_UPL) << 48); - wrmsr(MSR_STAR, msr); - wrmsr(MSR_SF_MASK, PSL_NT | PSL_T | PSL_I | PSL_C | PSL_D); -} - u_int64_t hammer_time(u_int64_t modulep, u_int64_t physfree) { @@ -1547,6 +1531,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct pcpu *pc; struct nmi_pcpu *np; struct xstate_hdr *xhdr; + u_int64_t msr; char *env; size_t kstack0_sz; int late_console; @@ -1687,7 +1672,15 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); ltr(gsel_tss); - amd64_conf_fast_syscall(); + /* Set up the fast syscall stuff */ + msr = rdmsr(MSR_EFER) | EFER_SCE; + wrmsr(MSR_EFER, msr); + wrmsr(MSR_LSTAR, (u_int64_t)IDTVEC(fast_syscall)); + wrmsr(MSR_CSTAR, (u_int64_t)IDTVEC(fast_syscall32)); + msr = ((u_int64_t)GSEL(GCODE_SEL, SEL_KPL) << 32) | + ((u_int64_t)GSEL(GUCODE32_SEL, SEL_UPL) << 48); + wrmsr(MSR_STAR, msr); + wrmsr(MSR_SF_MASK, PSL_NT|PSL_T|PSL_I|PSL_C|PSL_D); /* * Temporary forge some valid pointer to PCB, for exception diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 70b2e6d..ce07e0f 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -87,6 +87,8 @@ extern struct pcpu __pcpu[]; char *doublefault_stack; char *nmi_stack; +extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32); + /* * Local data and functions. */ @@ -186,7 +188,7 @@ init_secondary(void) { struct pcpu *pc; struct nmi_pcpu *np; - u_int64_t cr0; + u_int64_t msr, cr0; int cpu, gsel_tss, x; struct region_descriptor ap_gdt; @@ -261,7 +263,15 @@ init_secondary(void) cr0 &= ~(CR0_CD | CR0_NW | CR0_EM); load_cr0(cr0); - amd64_conf_fast_syscall(); + /* Set up the fast syscall stuff */ + msr = rdmsr(MSR_EFER) | EFER_SCE; + wrmsr(MSR_EFER, msr); + wrmsr(MSR_LSTAR, (u_int64_t)IDTVEC(fast_syscall)); + wrmsr(MSR_CSTAR, (u_int64_t)IDTVEC(fast_syscall32)); + msr = ((u_int64_t)GSEL(GCODE_SEL, SEL_KPL) << 32) | + ((u_int64_t)GSEL(GUCODE32_SEL, SEL_UPL) << 48); + wrmsr(MSR_STAR, msr); + wrmsr(MSR_SF_MASK, PSL_NT|PSL_T|PSL_I|PSL_C|PSL_D); /* signal our startup to the BSP. */ mp_naps++; diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 706ffc6..e4c50eb 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -38,7 +38,6 @@ extern uint64_t *vm_page_dump; struct savefpu; -void amd64_conf_fast_syscall(void); void amd64_db_resume_dbreg(void); void amd64_syscall(struct thread *td, int traced); void doreti_iret(void) __asm(__STRING(doreti_iret)); |