xref: /freebsd/sys/amd64/include/md_var.h (revision 10ff5eeb0422e78e973523cc40b0bb203b6e2100)
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 
39c0345a84SPeter Wemm extern uint64_t	*vm_page_dump;
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 
493705dda7SKonstantin Belousov /*
503705dda7SKonstantin Belousov  * The file "conf/ldscript.amd64" defines the symbol "kernphys".  Its
513705dda7SKonstantin Belousov  * value is the physical address at which the kernel is loaded.
523705dda7SKonstantin Belousov  */
533705dda7SKonstantin Belousov extern char kernphys[];
543705dda7SKonstantin Belousov 
557c958a41SKonstantin Belousov struct	savefpu;
56cd155b56SDon Lewis struct	sysentvec;
577c958a41SKonstantin Belousov 
580f7c159fSKonstantin Belousov void	amd64_conf_fast_syscall(void);
597c958a41SKonstantin Belousov void	amd64_db_resume_dbreg(void);
60cd155b56SDon Lewis void	amd64_lower_shared_page(struct sysentvec *);
61*10ff5eebSKonstantin Belousov void	amd64_bsp_pcpu_init1(struct pcpu *pc);
62*10ff5eebSKonstantin Belousov void	amd64_bsp_pcpu_init2(uint64_t rsp0);
63*10ff5eebSKonstantin Belousov void	amd64_bsp_ist_init(struct pcpu *pc);
6420aee906SKonstantin Belousov void	amd64_syscall(struct thread *td, int traced);
652dec2b4aSKonstantin Belousov void	amd64_syscall_ret_flush_l1d(int error);
662dec2b4aSKonstantin Belousov void	amd64_syscall_ret_flush_l1d_recalc(void);
67b63dc6adSAlfred Perlstein void	doreti_iret(void) __asm(__STRING(doreti_iret));
68b63dc6adSAlfred Perlstein void	doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault));
692dec2b4aSKonstantin Belousov void	flush_l1d_sw_abi(void);
702c66cccaSKonstantin Belousov void	ld_ds(void) __asm(__STRING(ld_ds));
712c66cccaSKonstantin Belousov void	ld_es(void) __asm(__STRING(ld_es));
722c66cccaSKonstantin Belousov void	ld_fs(void) __asm(__STRING(ld_fs));
732c66cccaSKonstantin Belousov void	ld_gs(void) __asm(__STRING(ld_gs));
74a35d07a8SKonstantin Belousov void	ld_fsbase(void) __asm(__STRING(ld_fsbase));
75a35d07a8SKonstantin Belousov void	ld_gsbase(void) __asm(__STRING(ld_gsbase));
762c66cccaSKonstantin Belousov void	ds_load_fault(void) __asm(__STRING(ds_load_fault));
772c66cccaSKonstantin Belousov void	es_load_fault(void) __asm(__STRING(es_load_fault));
782c66cccaSKonstantin Belousov void	fs_load_fault(void) __asm(__STRING(fs_load_fault));
792c66cccaSKonstantin Belousov void	gs_load_fault(void) __asm(__STRING(gs_load_fault));
80a35d07a8SKonstantin Belousov void	fsbase_load_fault(void) __asm(__STRING(fsbase_load_fault));
81a35d07a8SKonstantin Belousov void	gsbase_load_fault(void) __asm(__STRING(gsbase_load_fault));
82c64b7013SAlan Cox void	fpstate_drop(struct thread *td);
83c64b7013SAlan Cox void	pagezero(void *addr);
84afa88623SPeter Wemm void	setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist);
851a573587SBruce Evans void	sse2_pagezero(void *addr);
868c6f8f3dSKonstantin Belousov struct savefpu *get_pcb_user_save_td(struct thread *td);
878c6f8f3dSKonstantin Belousov struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb);
886bc6a542SKonstantin Belousov void	pci_early_quirks(void);
89b5e8ce9fSBruce Evans 
90b5e8ce9fSBruce Evans #endif /* !_MACHINE_MD_VAR_H_ */
91