Module Name: src Committed By: maxv Date: Wed May 1 14:29:15 UTC 2019
Modified Files: src/sys/arch/amd64/amd64: cpufunc.S src/sys/arch/i386/i386: cpufunc.S src/sys/arch/x86/include: cpufunc.h Log Message: Remove unused functions and reorder a little. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/amd64/cpufunc.S cvs rdiff -u -r1.28 -r1.29 src/sys/arch/i386/i386/cpufunc.S cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/include/cpufunc.h 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/amd64/amd64/cpufunc.S diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.36 src/sys/arch/amd64/amd64/cpufunc.S:1.37 --- src/sys/arch/amd64/amd64/cpufunc.S:1.36 Mon Feb 11 14:59:32 2019 +++ src/sys/arch/amd64/amd64/cpufunc.S Wed May 1 14:29:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.S,v 1.36 2019/02/11 14:59:32 cherry Exp $ */ +/* $NetBSD: cpufunc.S,v 1.37 2019/05/01 14:29:15 maxv Exp $ */ /* * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc. @@ -374,15 +374,6 @@ ENTRY(cpu_counter32) ret END(cpu_counter32) -ENTRY(rdpmc) - movq %rdi, %rcx - xorq %rax, %rax - rdpmc - shlq $32, %rdx - orq %rdx, %rax - ret -END(rdpmc) - ENTRY(rdtsc) xorq %rax,%rax rdtsc @@ -531,11 +522,6 @@ ENTRY(x86_getss) ret END(x86_getss) -ENTRY(fldcw) - fldcw (%rdi) - ret -END(fldcw) - ENTRY(fnclex) fnclex ret @@ -566,24 +552,11 @@ ENTRY(fnstsw) ret END(fnstsw) -ENTRY(fp_divide_by_0) - fldz - fld1 - fdiv %st, %st(1) - fwait - ret -END(fp_divide_by_0) - ENTRY(frstor) frstor (%rdi) ret END(frstor) -ENTRY(fwait) - fwait - ret -END(fwait) - ENTRY(clts) clts ret Index: src/sys/arch/i386/i386/cpufunc.S diff -u src/sys/arch/i386/i386/cpufunc.S:1.28 src/sys/arch/i386/i386/cpufunc.S:1.29 --- src/sys/arch/i386/i386/cpufunc.S:1.28 Mon Feb 11 14:59:32 2019 +++ src/sys/arch/i386/i386/cpufunc.S Wed May 1 14:29:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.S,v 1.28 2019/02/11 14:59:32 cherry Exp $ */ +/* $NetBSD: cpufunc.S,v 1.29 2019/05/01 14:29:15 maxv Exp $ */ /*- * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <sys/errno.h> #include <machine/asm.h> -__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.28 2019/02/11 14:59:32 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.29 2019/05/01 14:29:15 maxv Exp $"); #include "opt_xen.h" @@ -205,12 +205,6 @@ ENTRY(cpu_counter32) ret END(cpu_counter32) -ENTRY(rdpmc) - movl 4(%esp), %ecx - rdpmc - ret -END(rdpmc) - ENTRY(rdtsc) rdtsc ret @@ -328,12 +322,6 @@ ENTRY(x86_getss) ret END(x86_getss) -ENTRY(fldcw) - movl 4(%esp), %eax - fldcw (%eax) - ret -END(fldcw) - ENTRY(fnclex) fnclex ret @@ -367,25 +355,12 @@ ENTRY(fnstsw) ret END(fnstsw) -ENTRY(fp_divide_by_0) - fldz - fld1 - fdiv %st, %st(1) - fwait - ret -END(fp_divide_by_0) - ENTRY(frstor) movl 4(%esp), %eax frstor (%eax) ret END(frstor) -ENTRY(fwait) - fwait - ret -END(fwait) - ENTRY(clts) clts ret Index: src/sys/arch/x86/include/cpufunc.h diff -u src/sys/arch/x86/include/cpufunc.h:1.24 src/sys/arch/x86/include/cpufunc.h:1.25 --- src/sys/arch/x86/include/cpufunc.h:1.24 Thu Feb 22 09:41:06 2018 +++ src/sys/arch/x86/include/cpufunc.h Wed May 1 14:29:15 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: cpufunc.h,v 1.24 2018/02/22 09:41:06 maxv Exp $ */ +/* $NetBSD: cpufunc.h,v 1.25 2019/05/01 14:29:15 maxv Exp $ */ -/*- - * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. +/* + * Copyright (c) 1998, 2007, 2019 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -49,16 +49,33 @@ void x86_lfence(void); void x86_sfence(void); void x86_mfence(void); void x86_flush(void); +void x86_hlt(void); +void x86_stihlt(void); +void tlbflush(void); +void tlbflushg(void); +void invlpg(vaddr_t); +void wbinvd(void); +void breakpoint(void); +uint64_t rdtsc(void); #ifndef XEN void x86_hotpatch(uint32_t, const uint8_t *, size_t); void x86_patch_window_open(u_long *, u_long *); void x86_patch_window_close(u_long, u_long); void x86_patch(bool); #endif -void invlpg(vaddr_t); + +void x86_monitor(const void *, uint32_t, uint32_t); +void x86_mwait(uint32_t, uint32_t); +/* x86_cpuid2() writes four 32bit values, %eax, %ebx, %ecx and %edx */ +#define x86_cpuid(a,b) x86_cpuid2((a),0,(b)) +void x86_cpuid2(uint32_t, uint32_t, uint32_t *); + +/* -------------------------------------------------------------------------- */ + void lidt(struct region_descriptor *); void lldt(u_short); void ltr(u_short); + void lcr0(u_long); u_long rcr0(void); void lcr2(vaddr_t); @@ -69,8 +86,7 @@ void lcr4(vaddr_t); vaddr_t rcr4(void); void lcr8(vaddr_t); vaddr_t rcr8(void); -void tlbflush(void); -void tlbflushg(void); + register_t rdr0(void); void ldr0(register_t); register_t rdr1(void); @@ -83,15 +99,16 @@ register_t rdr6(void); void ldr6(register_t); register_t rdr7(void); void ldr7(register_t); -void wbinvd(void); -void breakpoint(void); -void x86_hlt(void); -void x86_stihlt(void); + u_int x86_getss(void); +void setds(int); +void setes(int); +void setfs(int); +void setusergs(int); + +/* -------------------------------------------------------------------------- */ -/* fpu save, restore etc */ union savefpu; -void fldcw(const uint16_t *); void fnclex(void); void fninit(void); void fnsave(union savefpu *); @@ -99,31 +116,23 @@ void fnstcw(uint16_t *); uint16_t fngetsw(void); void fnstsw(uint16_t *); void frstor(const union savefpu *); -void fwait(void); void clts(void); void stts(void); void fxsave(union savefpu *); void fxrstor(const union savefpu *); + void x86_ldmxcsr(const uint32_t *); void x86_stmxcsr(uint32_t *); - void fldummy(void); -void fp_divide_by_0(void); - -/* Extended processor state functions (for AVX registers etc) */ -uint64_t rdxcr(uint32_t); /* xgetbv */ -void wrxcr(uint32_t, uint64_t); /* xsetgv */ +uint64_t rdxcr(uint32_t); +void wrxcr(uint32_t, uint64_t); void xrstor(const union savefpu *, uint64_t); void xsave(union savefpu *, uint64_t); void xsaveopt(union savefpu *, uint64_t); -void x86_monitor(const void *, uint32_t, uint32_t); -void x86_mwait(uint32_t, uint32_t); -/* x86_cpuid2() writes four 32bit values, %eax, %ebx, %ecx and %edx */ -#define x86_cpuid(a,b) x86_cpuid2((a),0,(b)) -void x86_cpuid2(uint32_t, uint32_t, uint32_t *); +/* -------------------------------------------------------------------------- */ /* Use read_psl, write_psl when saving and restoring interrupt state. */ void x86_disable_intr(void); @@ -137,6 +146,8 @@ void x86_write_flags(u_long); void x86_reset(void); +/* -------------------------------------------------------------------------- */ + /* * Some of the undocumented AMD64 MSRs need a 'passcode' to access. * @@ -148,14 +159,8 @@ void x86_reset(void); uint64_t rdmsr(u_int); uint64_t rdmsr_locked(u_int); int rdmsr_safe(u_int, uint64_t *); -uint64_t rdtsc(void); -uint64_t rdpmc(u_int); void wrmsr(u_int, uint64_t); void wrmsr_locked(u_int, uint64_t); -void setds(int); -void setes(int); -void setfs(int); -void setusergs(int); #endif /* _KERNEL */