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/*
33114928Speter * Architecture specific syscalls (AMD64)
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
46190618Skib
47190618Skib/* XXX Not implementable #define I386_VM86	6 */
48190618Skib
49145077Speter#define	I386_GET_FSBASE		7
50145077Speter#define	I386_SET_FSBASE		8
51145077Speter#define	I386_GET_GSBASE		9
52145077Speter#define	I386_SET_GSBASE		10
53231979Skib#define	I386_GET_XFPUSTATE	11
54145077Speter
55121398Speter/* Leave space for 0-127 for to avoid translating syscalls */
56121398Speter#define	AMD64_GET_FSBASE	128
57121398Speter#define	AMD64_SET_FSBASE	129
58121398Speter#define	AMD64_GET_GSBASE	130
59121398Speter#define	AMD64_SET_GSBASE	131
60231979Skib#define	AMD64_GET_XFPUSTATE	132
61114928Speter
62190618Skibstruct i386_ldt_args {
63190618Skib	unsigned int start;
64190618Skib	struct user_segment_descriptor *descs __packed;
65190618Skib	unsigned int num;
66190618Skib};
67190618Skib
68190618Skibstruct i386_ioperm_args {
69190618Skib	unsigned int start;
70190618Skib	unsigned int length;
71190618Skib	int	enable;
72190618Skib};
73190618Skib
74231979Skibstruct i386_get_xfpustate {
75231979Skib	unsigned int addr;
76231979Skib	int len;
77231979Skib};
78231979Skib
79231979Skibstruct amd64_get_xfpustate {
80231979Skib	void *addr;
81231979Skib	int len;
82231979Skib};
83231979Skib
84114928Speter#ifndef _KERNEL
85114928Speter__BEGIN_DECLS
86121405Speterint amd64_get_fsbase(void **);
87124296Snectarint amd64_get_gsbase(void **);
88121405Speterint amd64_set_fsbase(void *);
89121405Speterint amd64_set_gsbase(void *);
90124296Snectarint sysarch(int, void *);
91114928Speter__END_DECLS
92190620Skib#else
93190620Skibstruct thread;
94190620Skibunion descriptor;
95190620Skib
96190620Skibint amd64_get_ldt(struct thread *, struct i386_ldt_args *);
97190620Skibint amd64_set_ldt(struct thread *, struct i386_ldt_args *,
98190620Skib    struct user_segment_descriptor *);
99190620Skibint amd64_get_ioperm(struct thread *, struct i386_ioperm_args *);
100190620Skibint amd64_set_ioperm(struct thread *, struct i386_ioperm_args *);
101114928Speter#endif
102114928Speter
10333049Sbde#endif /* !_MACHINE_SYSARCH_H_ */
104