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/*
33550Srgrimes * Architecture specific syscalls (i386)
34550Srgrimes */
35719Swollman#ifndef _MACHINE_SYSARCH_H_
3633049Sbde#define _MACHINE_SYSARCH_H_
37719Swollman
38550Srgrimes#define I386_GET_LDT	0
39550Srgrimes#define I386_SET_LDT	1
40118440Sjulian#define	LDT_AUTO_ALLOC	0xffffffff
4127993Sdyson				/* I386_IOPL */
4227993Sdyson#define I386_GET_IOPERM	3
4327993Sdyson#define I386_SET_IOPERM	4
4427993Sdyson				/* xxxxx */
4527993Sdyson#define I386_VM86	6
46145034Speter#define I386_GET_FSBASE	7
47145034Speter#define I386_SET_FSBASE	8
48145034Speter#define I386_GET_GSBASE	9
49145034Speter#define I386_SET_GSBASE	10
50231979Skib#define	I386_GET_XFPUSTATE 11
51550Srgrimes
52137289Speter/* These four only exist when running an i386 binary on amd64 */
53137289Speter#define	_AMD64_GET_FSBASE	128
54137289Speter#define	_AMD64_SET_FSBASE	129
55137289Speter#define	_AMD64_GET_GSBASE	130
56137289Speter#define	_AMD64_SET_GSBASE	131
57137289Speter
5850816Sluoqistruct i386_ldt_args {
59104110Speter	unsigned int start;
6050816Sluoqi	union	descriptor *descs;
61104110Speter	unsigned int num;
6250816Sluoqi};
6350816Sluoqi
6450816Sluoqistruct i386_ioperm_args {
6550816Sluoqi	unsigned int start;
6650816Sluoqi	unsigned int length;
6750816Sluoqi	int	enable;
6850816Sluoqi};
6950816Sluoqi
7050816Sluoqistruct i386_vm86_args {
7150816Sluoqi	int	sub_op;			/* sub-operation to perform */
7250816Sluoqi	char	*sub_args;		/* args */
7350816Sluoqi};
7450816Sluoqi
75231979Skibstruct i386_get_xfpustate {
76231979Skib	void *addr;
77231979Skib	int len;
78231979Skib};
79231979Skib
8055205Speter#ifndef _KERNEL
8133049Sbde#include <sys/cdefs.h>
8233049Sbde
8333049Sbdeunion descriptor;
8466174Sbsdstruct dbreg;
8533049Sbde
86719Swollman__BEGIN_DECLS
87137289Speter/* These four only exist when running an i386 binary on amd64 */
88137289Speterint _amd64_get_fsbase(void **);
89137289Speterint _amd64_get_gsbase(void **);
90137289Speterint _amd64_set_fsbase(void *);
91137289Speterint _amd64_set_gsbase(void *);
9292761Salfredint i386_get_ldt(int, union descriptor *, int);
9392761Salfredint i386_set_ldt(int, union descriptor *, int);
9492761Salfredint i386_get_ioperm(unsigned int, unsigned int *, int *);
9592761Salfredint i386_set_ioperm(unsigned int, unsigned int, int);
9692761Salfredint i386_vm86(int, void *);
97145034Speterint i386_get_fsbase(void **);
98145034Speterint i386_get_gsbase(void **);
99145034Speterint i386_set_fsbase(void *);
100145034Speterint i386_set_gsbase(void *);
10192761Salfredint i386_set_watch(int, unsigned int, int, int, struct dbreg *);
10292761Salfredint i386_clr_watch(int, struct dbreg *);
103124296Snectarint sysarch(int, void *);
10433049Sbde__END_DECLS
105140862Ssobomax#else
106140862Ssobomaxstruct thread;
107140862Ssobomaxunion descriptor;
108140862Ssobomax
109140862Ssobomaxint i386_get_ldt(struct thread *, struct i386_ldt_args *);
110140862Ssobomaxint i386_set_ldt(struct thread *, struct i386_ldt_args *, union descriptor *);
111140862Ssobomaxint i386_get_ioperm(struct thread *, struct i386_ioperm_args *);
112140862Ssobomaxint i386_set_ioperm(struct thread *, struct i386_ioperm_args *);
11355205Speter#endif
114719Swollman
11533049Sbde#endif /* !_MACHINE_SYSARCH_H_ */
116