xref: /freebsd/sys/amd64/include/md_var.h (revision c64b70130e1f12712db07270c46200d5dec76ab8)
1b5e8ce9fSBruce Evans /*-
2b5e8ce9fSBruce Evans  * Copyright (c) 1995 Bruce D. Evans.
3b5e8ce9fSBruce Evans  * All rights reserved.
4b5e8ce9fSBruce Evans  *
5b5e8ce9fSBruce Evans  * Redistribution and use in source and binary forms, with or without
6b5e8ce9fSBruce Evans  * modification, are permitted provided that the following conditions
7b5e8ce9fSBruce Evans  * are met:
8b5e8ce9fSBruce Evans  * 1. Redistributions of source code must retain the above copyright
9b5e8ce9fSBruce Evans  *    notice, this list of conditions and the following disclaimer.
10b5e8ce9fSBruce Evans  * 2. Redistributions in binary form must reproduce the above copyright
11b5e8ce9fSBruce Evans  *    notice, this list of conditions and the following disclaimer in the
12b5e8ce9fSBruce Evans  *    documentation and/or other materials provided with the distribution.
13b5e8ce9fSBruce Evans  * 3. Neither the name of the author nor the names of contributors
14b5e8ce9fSBruce Evans  *    may be used to endorse or promote products derived from this software
15b5e8ce9fSBruce Evans  *    without specific prior written permission.
16b5e8ce9fSBruce Evans  *
17b5e8ce9fSBruce Evans  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18b5e8ce9fSBruce Evans  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19b5e8ce9fSBruce Evans  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20b5e8ce9fSBruce Evans  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21b5e8ce9fSBruce Evans  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22b5e8ce9fSBruce Evans  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23b5e8ce9fSBruce Evans  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24b5e8ce9fSBruce Evans  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25b5e8ce9fSBruce Evans  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26b5e8ce9fSBruce Evans  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27b5e8ce9fSBruce Evans  * SUCH DAMAGE.
28b5e8ce9fSBruce Evans  *
29c3aac50fSPeter Wemm  * $FreeBSD$
30b5e8ce9fSBruce Evans  */
31b5e8ce9fSBruce Evans 
32b5e8ce9fSBruce Evans #ifndef _MACHINE_MD_VAR_H_
33b5e8ce9fSBruce Evans #define	_MACHINE_MD_VAR_H_
34b5e8ce9fSBruce Evans 
35b5e8ce9fSBruce Evans /*
36b5e8ce9fSBruce Evans  * Miscellaneous machine-dependent declarations.
37b5e8ce9fSBruce Evans  */
38b5e8ce9fSBruce Evans 
399f45b2daSDag-Erling Smørgrav extern	long	Maxmem;
40eeee69d4SPeter Wemm extern	u_long	atdevbase;	/* offset in virtual memory of ISA io mem */
410d2a2989SPeter Wemm extern	u_int	basemem;
429f45b2daSDag-Erling Smørgrav extern	int	busdma_swi_pending;
4326aa6d02SJohn Baldwin extern	u_int	cpu_exthigh;
4488bf59fcSBruce Evans extern	u_int	cpu_feature;
459d146ac5SPeter Wemm extern	u_int	cpu_fxsr;
4610deca7eSJohn Baldwin extern	u_int	cpu_high;
4710deca7eSJohn Baldwin extern	u_int	cpu_id;
4810deca7eSJohn Baldwin extern	u_int	cpu_procinfo;
49b5e8ce9fSBruce Evans extern	char	cpu_vendor[];
50b5e8ce9fSBruce Evans extern	char	kstack[];
51d66a5066SPeter Wemm extern	char	sigcode[];
5223eeeff7SPeter Wemm extern	int	szsigcode;
530d2a2989SPeter Wemm 
540d2a2989SPeter Wemm extern	struct pcpu __pcpu[];
55b5e8ce9fSBruce Evans 
56b63dc6adSAlfred Perlstein typedef void alias_for_inthand_t(u_int cs, u_int ef, u_int esp, u_int ss);
57b40ce416SJulian Elischer struct	thread;
58b5e8ce9fSBruce Evans struct	reg;
591a291e0cSJohn Polstra struct	fpreg;
60ab001a72SJonathan Lemon struct  dbreg;
61b5e8ce9fSBruce Evans 
62b63dc6adSAlfred Perlstein void	busdma_swi(void);
63b63dc6adSAlfred Perlstein void	cpu_setregs(void);
64b63dc6adSAlfred Perlstein void	doreti_iret(void) __asm(__STRING(doreti_iret));
65b63dc6adSAlfred Perlstein void	doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault));
6610deca7eSJohn Baldwin void	enable_sse(void);
67b63dc6adSAlfred Perlstein void	fillw(int /*u_short*/ pat, void *base, size_t cnt);
68c64b7013SAlan Cox void	fpstate_drop(struct thread *td);
69b63dc6adSAlfred Perlstein int	is_physical_memory(vm_offset_t addr);
700d2a2989SPeter Wemm int	isa_nmi(int cd);
71c64b7013SAlan Cox void	pagecopy(void *from, void *to);
72c64b7013SAlan Cox void	pagezero(void *addr);
73afa88623SPeter Wemm void	setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist);
74170a0551SPeter Wemm int	user_dbreg_trap(void);
75b5e8ce9fSBruce Evans 
76b5e8ce9fSBruce Evans #endif /* !_MACHINE_MD_VAR_H_ */
77