1b5e8ce9fSBruce Evans /*- 251369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 351369649SPedro F. Giffuni * 4b5e8ce9fSBruce Evans * Copyright (c) 1995 Bruce D. Evans. 5b5e8ce9fSBruce Evans * All rights reserved. 6b5e8ce9fSBruce Evans * 7b5e8ce9fSBruce Evans * Redistribution and use in source and binary forms, with or without 8b5e8ce9fSBruce Evans * modification, are permitted provided that the following conditions 9b5e8ce9fSBruce Evans * are met: 10b5e8ce9fSBruce Evans * 1. Redistributions of source code must retain the above copyright 11b5e8ce9fSBruce Evans * notice, this list of conditions and the following disclaimer. 12b5e8ce9fSBruce Evans * 2. Redistributions in binary form must reproduce the above copyright 13b5e8ce9fSBruce Evans * notice, this list of conditions and the following disclaimer in the 14b5e8ce9fSBruce Evans * documentation and/or other materials provided with the distribution. 15b5e8ce9fSBruce Evans * 3. Neither the name of the author nor the names of contributors 16b5e8ce9fSBruce Evans * may be used to endorse or promote products derived from this software 17b5e8ce9fSBruce Evans * without specific prior written permission. 18b5e8ce9fSBruce Evans * 19b5e8ce9fSBruce Evans * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20b5e8ce9fSBruce Evans * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21b5e8ce9fSBruce Evans * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22b5e8ce9fSBruce Evans * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23b5e8ce9fSBruce Evans * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24b5e8ce9fSBruce Evans * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25b5e8ce9fSBruce Evans * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26b5e8ce9fSBruce Evans * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27b5e8ce9fSBruce Evans * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28b5e8ce9fSBruce Evans * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29b5e8ce9fSBruce Evans * SUCH DAMAGE. 30b5e8ce9fSBruce Evans */ 31b5e8ce9fSBruce Evans 325ea3094eSBrooks Davis #ifdef __i386__ 335ea3094eSBrooks Davis #include <i386/md_var.h> 345ea3094eSBrooks Davis #else /* !__i386__ */ 355ea3094eSBrooks Davis 36b5e8ce9fSBruce Evans #ifndef _MACHINE_MD_VAR_H_ 37b5e8ce9fSBruce Evans #define _MACHINE_MD_VAR_H_ 38b5e8ce9fSBruce Evans 397c958a41SKonstantin Belousov #include <x86/x86_var.h> 40b5e8ce9fSBruce Evans 415e8ea68fSKonstantin Belousov extern char ctx_switch_xsave[]; 42df013409SKonstantin Belousov extern char ctx_switch_xsave32[]; 43cd155b56SDon Lewis extern int hw_lower_amd64_sharedpage; 44319117fdSKonstantin Belousov extern int hw_ibrs_disable; 453621ba1eSKonstantin Belousov extern int hw_ssb_disable; 46c1141fbaSKonstantin Belousov extern int nmi_flush_l1d_sw; 472dec2b4aSKonstantin Belousov extern int syscall_ret_l1d_flush_mode; 480d2a2989SPeter Wemm 496bc6a542SKonstantin Belousov extern vm_paddr_t intel_graphics_stolen_base; 506bc6a542SKonstantin Belousov extern vm_paddr_t intel_graphics_stolen_size; 516bc6a542SKonstantin Belousov 529ce875d9SKonstantin Belousov extern int la57; 539ce875d9SKonstantin Belousov 54e18380e3SKonstantin Belousov extern vm_paddr_t kernphys; 55e18380e3SKonstantin Belousov extern vm_paddr_t KERNend; 563705dda7SKonstantin Belousov 576a382136SKonstantin Belousov extern bool efi_boot; 586a382136SKonstantin Belousov 59562bc0a9SEdward Tomasz Napierala struct __mcontext; 607c958a41SKonstantin Belousov struct savefpu; 61cd155b56SDon Lewis struct sysentvec; 627c958a41SKonstantin Belousov 630f7c159fSKonstantin Belousov void amd64_conf_fast_syscall(void); 647c958a41SKonstantin Belousov void amd64_db_resume_dbreg(void); 65756bc3adSMark Johnston vm_paddr_t amd64_loadaddr(void); 66cd155b56SDon Lewis void amd64_lower_shared_page(struct sysentvec *); 6710ff5eebSKonstantin Belousov void amd64_bsp_pcpu_init1(struct pcpu *pc); 6810ff5eebSKonstantin Belousov void amd64_bsp_pcpu_init2(uint64_t rsp0); 6910ff5eebSKonstantin Belousov void amd64_bsp_ist_init(struct pcpu *pc); 7020aee906SKonstantin Belousov void amd64_syscall(struct thread *td, int traced); 712dec2b4aSKonstantin Belousov void amd64_syscall_ret_flush_l1d(int error); 722dec2b4aSKonstantin Belousov void amd64_syscall_ret_flush_l1d_recalc(void); 73*a2c08ebaSKonstantin Belousov void cpu_init_small_core(void); 74b63dc6adSAlfred Perlstein void doreti_iret(void) __asm(__STRING(doreti_iret)); 75b63dc6adSAlfred Perlstein void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); 762dec2b4aSKonstantin Belousov void flush_l1d_sw_abi(void); 772c66cccaSKonstantin Belousov void ld_ds(void) __asm(__STRING(ld_ds)); 782c66cccaSKonstantin Belousov void ld_es(void) __asm(__STRING(ld_es)); 792c66cccaSKonstantin Belousov void ld_fs(void) __asm(__STRING(ld_fs)); 802c66cccaSKonstantin Belousov void ld_gs(void) __asm(__STRING(ld_gs)); 81a35d07a8SKonstantin Belousov void ld_fsbase(void) __asm(__STRING(ld_fsbase)); 82a35d07a8SKonstantin Belousov void ld_gsbase(void) __asm(__STRING(ld_gsbase)); 832c66cccaSKonstantin Belousov void ds_load_fault(void) __asm(__STRING(ds_load_fault)); 842c66cccaSKonstantin Belousov void es_load_fault(void) __asm(__STRING(es_load_fault)); 852c66cccaSKonstantin Belousov void fs_load_fault(void) __asm(__STRING(fs_load_fault)); 862c66cccaSKonstantin Belousov void gs_load_fault(void) __asm(__STRING(gs_load_fault)); 87a35d07a8SKonstantin Belousov void fsbase_load_fault(void) __asm(__STRING(fsbase_load_fault)); 88a35d07a8SKonstantin Belousov void gsbase_load_fault(void) __asm(__STRING(gsbase_load_fault)); 89c64b7013SAlan Cox void fpstate_drop(struct thread *td); 90c64b7013SAlan Cox void pagezero(void *addr); 91afa88623SPeter Wemm void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); 925e921ff4SKonstantin Belousov void set_top_of_stack_td(struct thread *td); 938c6f8f3dSKonstantin Belousov struct savefpu *get_pcb_user_save_td(struct thread *td); 948c6f8f3dSKonstantin Belousov struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb); 956bc6a542SKonstantin Belousov void pci_early_quirks(void); 96562bc0a9SEdward Tomasz Napierala void get_fpcontext(struct thread *td, struct __mcontext *mcp, 97562bc0a9SEdward Tomasz Napierala char **xfpusave, size_t *xfpusave_len); 98562bc0a9SEdward Tomasz Napierala int set_fpcontext(struct thread *td, struct __mcontext *mcp, 99562bc0a9SEdward Tomasz Napierala char *xfpustate, size_t xfpustate_len); 100b5e8ce9fSBruce Evans 101b5e8ce9fSBruce Evans #endif /* !_MACHINE_MD_VAR_H_ */ 1025ea3094eSBrooks Davis 1035ea3094eSBrooks Davis #endif /* __i386__ */ 104