xref: /freebsd/sys/x86/include/sysarch.h (revision dfb1c11345977ebae4338da7b583211f4917042a)
1*dfb1c113STijl Coosemans /*-
2*dfb1c113STijl Coosemans  * Copyright (c) 1993 The Regents of the University of California.
3*dfb1c113STijl Coosemans  * All rights reserved.
4*dfb1c113STijl Coosemans  *
5*dfb1c113STijl Coosemans  * Redistribution and use in source and binary forms, with or without
6*dfb1c113STijl Coosemans  * modification, are permitted provided that the following conditions
7*dfb1c113STijl Coosemans  * are met:
8*dfb1c113STijl Coosemans  * 1. Redistributions of source code must retain the above copyright
9*dfb1c113STijl Coosemans  *    notice, this list of conditions and the following disclaimer.
10*dfb1c113STijl Coosemans  * 2. Redistributions in binary form must reproduce the above copyright
11*dfb1c113STijl Coosemans  *    notice, this list of conditions and the following disclaimer in the
12*dfb1c113STijl Coosemans  *    documentation and/or other materials provided with the distribution.
13*dfb1c113STijl Coosemans  * 4. Neither the name of the University nor the names of its contributors
14*dfb1c113STijl Coosemans  *    may be used to endorse or promote products derived from this software
15*dfb1c113STijl Coosemans  *    without specific prior written permission.
16*dfb1c113STijl Coosemans  *
17*dfb1c113STijl Coosemans  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18*dfb1c113STijl Coosemans  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*dfb1c113STijl Coosemans  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*dfb1c113STijl Coosemans  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21*dfb1c113STijl Coosemans  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*dfb1c113STijl Coosemans  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*dfb1c113STijl Coosemans  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*dfb1c113STijl Coosemans  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*dfb1c113STijl Coosemans  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*dfb1c113STijl Coosemans  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*dfb1c113STijl Coosemans  * SUCH DAMAGE.
28*dfb1c113STijl Coosemans  *
29*dfb1c113STijl Coosemans  * $FreeBSD$
30*dfb1c113STijl Coosemans  */
31*dfb1c113STijl Coosemans 
32*dfb1c113STijl Coosemans /*
33*dfb1c113STijl Coosemans  * Architecture specific syscalls (X86)
34*dfb1c113STijl Coosemans  */
35*dfb1c113STijl Coosemans #ifndef _MACHINE_SYSARCH_H_
36*dfb1c113STijl Coosemans #define _MACHINE_SYSARCH_H_
37*dfb1c113STijl Coosemans 
38*dfb1c113STijl Coosemans #include <sys/cdefs.h>
39*dfb1c113STijl Coosemans 
40*dfb1c113STijl Coosemans #define I386_GET_LDT	0
41*dfb1c113STijl Coosemans #define I386_SET_LDT	1
42*dfb1c113STijl Coosemans #define	LDT_AUTO_ALLOC	0xffffffff
43*dfb1c113STijl Coosemans 				/* I386_IOPL */
44*dfb1c113STijl Coosemans #define I386_GET_IOPERM	3
45*dfb1c113STijl Coosemans #define I386_SET_IOPERM	4
46*dfb1c113STijl Coosemans 				/* xxxxx */
47*dfb1c113STijl Coosemans #define	I386_VM86		6	/* XXX Not implementable on amd64 */
48*dfb1c113STijl Coosemans #define	I386_GET_FSBASE		7
49*dfb1c113STijl Coosemans #define	I386_SET_FSBASE		8
50*dfb1c113STijl Coosemans #define	I386_GET_GSBASE		9
51*dfb1c113STijl Coosemans #define	I386_SET_GSBASE		10
52*dfb1c113STijl Coosemans #define	I386_GET_XFPUSTATE	11
53*dfb1c113STijl Coosemans 
54*dfb1c113STijl Coosemans /* Leave space for 0-127 for to avoid translating syscalls */
55*dfb1c113STijl Coosemans #define	AMD64_GET_FSBASE	128
56*dfb1c113STijl Coosemans #define	AMD64_SET_FSBASE	129
57*dfb1c113STijl Coosemans #define	AMD64_GET_GSBASE	130
58*dfb1c113STijl Coosemans #define	AMD64_SET_GSBASE	131
59*dfb1c113STijl Coosemans #define	AMD64_GET_XFPUSTATE	132
60*dfb1c113STijl Coosemans 
61*dfb1c113STijl Coosemans struct i386_ioperm_args {
62*dfb1c113STijl Coosemans 	unsigned int start;
63*dfb1c113STijl Coosemans 	unsigned int length;
64*dfb1c113STijl Coosemans 	int	enable;
65*dfb1c113STijl Coosemans };
66*dfb1c113STijl Coosemans 
67*dfb1c113STijl Coosemans #ifdef __i386__
68*dfb1c113STijl Coosemans struct i386_ldt_args {
69*dfb1c113STijl Coosemans 	unsigned int start;
70*dfb1c113STijl Coosemans 	union descriptor *descs;
71*dfb1c113STijl Coosemans 	unsigned int num;
72*dfb1c113STijl Coosemans };
73*dfb1c113STijl Coosemans 
74*dfb1c113STijl Coosemans struct i386_vm86_args {
75*dfb1c113STijl Coosemans 	int	sub_op;			/* sub-operation to perform */
76*dfb1c113STijl Coosemans 	char	*sub_args;		/* args */
77*dfb1c113STijl Coosemans };
78*dfb1c113STijl Coosemans 
79*dfb1c113STijl Coosemans struct i386_get_xfpustate {
80*dfb1c113STijl Coosemans 	void *addr;
81*dfb1c113STijl Coosemans 	int len;
82*dfb1c113STijl Coosemans };
83*dfb1c113STijl Coosemans #else
84*dfb1c113STijl Coosemans struct i386_ldt_args {
85*dfb1c113STijl Coosemans 	unsigned int start;
86*dfb1c113STijl Coosemans 	struct user_segment_descriptor *descs __packed;
87*dfb1c113STijl Coosemans 	unsigned int num;
88*dfb1c113STijl Coosemans };
89*dfb1c113STijl Coosemans 
90*dfb1c113STijl Coosemans struct i386_get_xfpustate {
91*dfb1c113STijl Coosemans 	unsigned int addr;
92*dfb1c113STijl Coosemans 	int len;
93*dfb1c113STijl Coosemans };
94*dfb1c113STijl Coosemans 
95*dfb1c113STijl Coosemans struct amd64_get_xfpustate {
96*dfb1c113STijl Coosemans 	void *addr;
97*dfb1c113STijl Coosemans 	int len;
98*dfb1c113STijl Coosemans };
99*dfb1c113STijl Coosemans #endif
100*dfb1c113STijl Coosemans 
101*dfb1c113STijl Coosemans #ifndef _KERNEL
102*dfb1c113STijl Coosemans union descriptor;
103*dfb1c113STijl Coosemans struct dbreg;
104*dfb1c113STijl Coosemans 
105*dfb1c113STijl Coosemans __BEGIN_DECLS
106*dfb1c113STijl Coosemans int i386_get_ldt(int, union descriptor *, int);
107*dfb1c113STijl Coosemans int i386_set_ldt(int, union descriptor *, int);
108*dfb1c113STijl Coosemans int i386_get_ioperm(unsigned int, unsigned int *, int *);
109*dfb1c113STijl Coosemans int i386_set_ioperm(unsigned int, unsigned int, int);
110*dfb1c113STijl Coosemans int i386_vm86(int, void *);
111*dfb1c113STijl Coosemans int i386_get_fsbase(void **);
112*dfb1c113STijl Coosemans int i386_get_gsbase(void **);
113*dfb1c113STijl Coosemans int i386_set_fsbase(void *);
114*dfb1c113STijl Coosemans int i386_set_gsbase(void *);
115*dfb1c113STijl Coosemans int i386_set_watch(int, unsigned int, int, int, struct dbreg *);
116*dfb1c113STijl Coosemans int i386_clr_watch(int, struct dbreg *);
117*dfb1c113STijl Coosemans int amd64_get_fsbase(void **);
118*dfb1c113STijl Coosemans int amd64_get_gsbase(void **);
119*dfb1c113STijl Coosemans int amd64_set_fsbase(void *);
120*dfb1c113STijl Coosemans int amd64_set_gsbase(void *);
121*dfb1c113STijl Coosemans int sysarch(int, void *);
122*dfb1c113STijl Coosemans __END_DECLS
123*dfb1c113STijl Coosemans #else
124*dfb1c113STijl Coosemans struct thread;
125*dfb1c113STijl Coosemans union descriptor;
126*dfb1c113STijl Coosemans 
127*dfb1c113STijl Coosemans int i386_get_ldt(struct thread *, struct i386_ldt_args *);
128*dfb1c113STijl Coosemans int i386_set_ldt(struct thread *, struct i386_ldt_args *, union descriptor *);
129*dfb1c113STijl Coosemans int i386_get_ioperm(struct thread *, struct i386_ioperm_args *);
130*dfb1c113STijl Coosemans int i386_set_ioperm(struct thread *, struct i386_ioperm_args *);
131*dfb1c113STijl Coosemans int amd64_get_ldt(struct thread *, struct i386_ldt_args *);
132*dfb1c113STijl Coosemans int amd64_set_ldt(struct thread *, struct i386_ldt_args *,
133*dfb1c113STijl Coosemans     struct user_segment_descriptor *);
134*dfb1c113STijl Coosemans int amd64_get_ioperm(struct thread *, struct i386_ioperm_args *);
135*dfb1c113STijl Coosemans int amd64_set_ioperm(struct thread *, struct i386_ioperm_args *);
136*dfb1c113STijl Coosemans #endif
137*dfb1c113STijl Coosemans 
138*dfb1c113STijl Coosemans #endif /* !_MACHINE_SYSARCH_H_ */
139