11817Sdg/*-
21817Sdg * Copyright (c) 1993 The Regents of the University of California.
31817Sdg * All rights reserved.
41817Sdg *
51817Sdg * Redistribution and use in source and binary forms, with or without
61817Sdg * modification, are permitted provided that the following conditions
71817Sdg * are met:
81817Sdg * 1. Redistributions of source code must retain the above copyright
91817Sdg *    notice, this list of conditions and the following disclaimer.
101817Sdg * 2. Redistributions in binary form must reproduce the above copyright
111817Sdg *    notice, this list of conditions and the following disclaimer in the
121817Sdg *    documentation and/or other materials provided with the distribution.
131817Sdg * 4. Neither the name of the University nor the names of its contributors
141817Sdg *    may be used to endorse or promote products derived from this software
151817Sdg *    without specific prior written permission.
161817Sdg *
171817Sdg * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181817Sdg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191817Sdg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201817Sdg * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211817Sdg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221817Sdg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231817Sdg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241817Sdg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251817Sdg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261817Sdg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271817Sdg * SUCH DAMAGE.
281817Sdg *
2950477Speter * $FreeBSD$
301817Sdg */
311817Sdg
32550Srgrimes/*
33233209Stijl * Architecture specific syscalls (X86)
34550Srgrimes */
35719Swollman#ifndef _MACHINE_SYSARCH_H_
3633049Sbde#define _MACHINE_SYSARCH_H_
37719Swollman
38204118Sed#include <sys/cdefs.h>
39204118Sed
40190618Skib#define I386_GET_LDT	0
41190618Skib#define I386_SET_LDT	1
42190618Skib#define	LDT_AUTO_ALLOC	0xffffffff
43190618Skib				/* I386_IOPL */
44190618Skib#define I386_GET_IOPERM	3
45190618Skib#define I386_SET_IOPERM	4
46233209Stijl				/* xxxxx */
47233209Stijl#define	I386_VM86		6	/* XXX Not implementable on amd64 */
48145077Speter#define	I386_GET_FSBASE		7
49145077Speter#define	I386_SET_FSBASE		8
50145077Speter#define	I386_GET_GSBASE		9
51145077Speter#define	I386_SET_GSBASE		10
52230426Skib#define	I386_GET_XFPUSTATE	11
53145077Speter
54121398Speter/* Leave space for 0-127 for to avoid translating syscalls */
55121398Speter#define	AMD64_GET_FSBASE	128
56121398Speter#define	AMD64_SET_FSBASE	129
57121398Speter#define	AMD64_GET_GSBASE	130
58121398Speter#define	AMD64_SET_GSBASE	131
59230426Skib#define	AMD64_GET_XFPUSTATE	132
60114928Speter
61233209Stijlstruct i386_ioperm_args {
62233209Stijl	unsigned int start;
63233209Stijl	unsigned int length;
64233209Stijl	int	enable;
65233209Stijl};
66233209Stijl
67233209Stijl#ifdef __i386__
68190618Skibstruct i386_ldt_args {
69190618Skib	unsigned int start;
70233209Stijl	union descriptor *descs;
71190618Skib	unsigned int num;
72190618Skib};
73190618Skib
74233209Stijlstruct i386_vm86_args {
75233209Stijl	int	sub_op;			/* sub-operation to perform */
76233209Stijl	char	*sub_args;		/* args */
77233209Stijl};
78233209Stijl
79233209Stijlstruct i386_get_xfpustate {
80233209Stijl	void *addr;
81233209Stijl	int len;
82233209Stijl};
83233209Stijl#else
84233209Stijlstruct i386_ldt_args {
85190618Skib	unsigned int start;
86233209Stijl	struct user_segment_descriptor *descs __packed;
87233209Stijl	unsigned int num;
88190618Skib};
89190618Skib
90230426Skibstruct i386_get_xfpustate {
91230426Skib	unsigned int addr;
92230426Skib	int len;
93230426Skib};
94230426Skib
95230426Skibstruct amd64_get_xfpustate {
96230426Skib	void *addr;
97230426Skib	int len;
98230426Skib};
99233209Stijl#endif
100230426Skib
101114928Speter#ifndef _KERNEL
102233209Stijlunion descriptor;
103233209Stijlstruct dbreg;
104233209Stijl
105114928Speter__BEGIN_DECLS
106233209Stijlint i386_get_ldt(int, union descriptor *, int);
107233209Stijlint i386_set_ldt(int, union descriptor *, int);
108233209Stijlint i386_get_ioperm(unsigned int, unsigned int *, int *);
109233209Stijlint i386_set_ioperm(unsigned int, unsigned int, int);
110233209Stijlint i386_vm86(int, void *);
111233209Stijlint i386_get_fsbase(void **);
112233209Stijlint i386_get_gsbase(void **);
113233209Stijlint i386_set_fsbase(void *);
114233209Stijlint i386_set_gsbase(void *);
115233209Stijlint i386_set_watch(int, unsigned int, int, int, struct dbreg *);
116233209Stijlint i386_clr_watch(int, struct dbreg *);
117121405Speterint amd64_get_fsbase(void **);
118124296Snectarint amd64_get_gsbase(void **);
119121405Speterint amd64_set_fsbase(void *);
120121405Speterint amd64_set_gsbase(void *);
121124296Snectarint sysarch(int, void *);
122114928Speter__END_DECLS
123190620Skib#else
124190620Skibstruct thread;
125190620Skibunion descriptor;
126190620Skib
127233209Stijlint i386_get_ldt(struct thread *, struct i386_ldt_args *);
128233209Stijlint i386_set_ldt(struct thread *, struct i386_ldt_args *, union descriptor *);
129233209Stijlint i386_get_ioperm(struct thread *, struct i386_ioperm_args *);
130233209Stijlint i386_set_ioperm(struct thread *, struct i386_ioperm_args *);
131190620Skibint amd64_get_ldt(struct thread *, struct i386_ldt_args *);
132190620Skibint amd64_set_ldt(struct thread *, struct i386_ldt_args *,
133190620Skib    struct user_segment_descriptor *);
134190620Skibint amd64_get_ioperm(struct thread *, struct i386_ioperm_args *);
135190620Skibint amd64_set_ioperm(struct thread *, struct i386_ioperm_args *);
136114928Speter#endif
137114928Speter
13833049Sbde#endif /* !_MACHINE_SYSARCH_H_ */
139