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 * 31c3aac50fSPeter Wemm * $FreeBSD$ 32b5e8ce9fSBruce Evans */ 33b5e8ce9fSBruce Evans 34b5e8ce9fSBruce Evans #ifndef _MACHINE_MD_VAR_H_ 35b5e8ce9fSBruce Evans #define _MACHINE_MD_VAR_H_ 36b5e8ce9fSBruce Evans 377c958a41SKonstantin Belousov #include <x86/x86_var.h> 38b5e8ce9fSBruce Evans 39*5e8ea68fSKonstantin Belousov extern char ctx_switch_xsave[]; 40cd155b56SDon Lewis extern int hw_lower_amd64_sharedpage; 41319117fdSKonstantin Belousov extern int hw_ibrs_disable; 423621ba1eSKonstantin Belousov extern int hw_ssb_disable; 43c1141fbaSKonstantin Belousov extern int nmi_flush_l1d_sw; 442dec2b4aSKonstantin Belousov extern int syscall_ret_l1d_flush_mode; 450d2a2989SPeter Wemm 466bc6a542SKonstantin Belousov extern vm_paddr_t intel_graphics_stolen_base; 476bc6a542SKonstantin Belousov extern vm_paddr_t intel_graphics_stolen_size; 486bc6a542SKonstantin Belousov 499ce875d9SKonstantin Belousov extern int la57; 509ce875d9SKonstantin Belousov 513705dda7SKonstantin Belousov /* 523705dda7SKonstantin Belousov * The file "conf/ldscript.amd64" defines the symbol "kernphys". Its 533705dda7SKonstantin Belousov * value is the physical address at which the kernel is loaded. 543705dda7SKonstantin Belousov */ 553705dda7SKonstantin Belousov extern char kernphys[]; 563705dda7SKonstantin Belousov 577c958a41SKonstantin Belousov struct savefpu; 58cd155b56SDon Lewis struct sysentvec; 597c958a41SKonstantin Belousov 600f7c159fSKonstantin Belousov void amd64_conf_fast_syscall(void); 617c958a41SKonstantin Belousov void amd64_db_resume_dbreg(void); 62cd155b56SDon Lewis void amd64_lower_shared_page(struct sysentvec *); 6310ff5eebSKonstantin Belousov void amd64_bsp_pcpu_init1(struct pcpu *pc); 6410ff5eebSKonstantin Belousov void amd64_bsp_pcpu_init2(uint64_t rsp0); 6510ff5eebSKonstantin Belousov void amd64_bsp_ist_init(struct pcpu *pc); 6620aee906SKonstantin Belousov void amd64_syscall(struct thread *td, int traced); 672dec2b4aSKonstantin Belousov void amd64_syscall_ret_flush_l1d(int error); 682dec2b4aSKonstantin Belousov void amd64_syscall_ret_flush_l1d_recalc(void); 69b63dc6adSAlfred Perlstein void doreti_iret(void) __asm(__STRING(doreti_iret)); 70b63dc6adSAlfred Perlstein void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault)); 712dec2b4aSKonstantin Belousov void flush_l1d_sw_abi(void); 722c66cccaSKonstantin Belousov void ld_ds(void) __asm(__STRING(ld_ds)); 732c66cccaSKonstantin Belousov void ld_es(void) __asm(__STRING(ld_es)); 742c66cccaSKonstantin Belousov void ld_fs(void) __asm(__STRING(ld_fs)); 752c66cccaSKonstantin Belousov void ld_gs(void) __asm(__STRING(ld_gs)); 76a35d07a8SKonstantin Belousov void ld_fsbase(void) __asm(__STRING(ld_fsbase)); 77a35d07a8SKonstantin Belousov void ld_gsbase(void) __asm(__STRING(ld_gsbase)); 782c66cccaSKonstantin Belousov void ds_load_fault(void) __asm(__STRING(ds_load_fault)); 792c66cccaSKonstantin Belousov void es_load_fault(void) __asm(__STRING(es_load_fault)); 802c66cccaSKonstantin Belousov void fs_load_fault(void) __asm(__STRING(fs_load_fault)); 812c66cccaSKonstantin Belousov void gs_load_fault(void) __asm(__STRING(gs_load_fault)); 82a35d07a8SKonstantin Belousov void fsbase_load_fault(void) __asm(__STRING(fsbase_load_fault)); 83a35d07a8SKonstantin Belousov void gsbase_load_fault(void) __asm(__STRING(gsbase_load_fault)); 84c64b7013SAlan Cox void fpstate_drop(struct thread *td); 85c64b7013SAlan Cox void pagezero(void *addr); 86afa88623SPeter Wemm void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); 871a573587SBruce Evans void sse2_pagezero(void *addr); 885e921ff4SKonstantin Belousov void set_top_of_stack_td(struct thread *td); 898c6f8f3dSKonstantin Belousov struct savefpu *get_pcb_user_save_td(struct thread *td); 908c6f8f3dSKonstantin Belousov struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb); 916bc6a542SKonstantin Belousov void pci_early_quirks(void); 92b5e8ce9fSBruce Evans 93b5e8ce9fSBruce Evans #endif /* !_MACHINE_MD_VAR_H_ */ 94