sysarch.h revision 204120
1102227Smike/*-
2102227Smike * Copyright (c) 1993 The Regents of the University of California.
3102227Smike * All rights reserved.
4102227Smike *
5102227Smike * Redistribution and use in source and binary forms, with or without
6102227Smike * modification, are permitted provided that the following conditions
7102227Smike * are met:
8102227Smike * 1. Redistributions of source code must retain the above copyright
9102227Smike *    notice, this list of conditions and the following disclaimer.
10102227Smike * 2. Redistributions in binary form must reproduce the above copyright
11102227Smike *    notice, this list of conditions and the following disclaimer in the
12102227Smike *    documentation and/or other materials provided with the distribution.
13102227Smike * 4. Neither the name of the University nor the names of its contributors
14102227Smike *    may be used to endorse or promote products derived from this software
15102227Smike *    without specific prior written permission.
16102227Smike *
17102227Smike * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18102227Smike * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19102227Smike * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20102227Smike * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21102227Smike * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22102227Smike * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23102227Smike * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24102227Smike * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25102227Smike * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26102227Smike * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27102227Smike * SUCH DAMAGE.
28102227Smike *
29102227Smike * $FreeBSD: head/sys/amd64/include/sysarch.h 204120 2010-02-20 14:13:47Z ed $
30102227Smike */
31102227Smike
32102227Smike/*
33102227Smike * Architecture specific syscalls (AMD64)
34102227Smike */
35102227Smike#ifndef _MACHINE_SYSARCH_H_
36102227Smike#define _MACHINE_SYSARCH_H_
37102227Smike
38102227Smike#include <sys/cdefs.h>
39102227Smike
40102227Smike#define I386_GET_LDT	0
41102227Smike#define I386_SET_LDT	1
42143063Sjoerg#define	LDT_AUTO_ALLOC	0xffffffff
43143063Sjoerg				/* I386_IOPL */
44143063Sjoerg#define I386_GET_IOPERM	3
45143063Sjoerg#define I386_SET_IOPERM	4
46147744Sthompsa
47147744Sthompsa/* XXX Not implementable #define I386_VM86	6 */
48102227Smike
49102227Smike#define	I386_GET_FSBASE		7
50102227Smike#define	I386_SET_FSBASE		8
51102227Smike#define	I386_GET_GSBASE		9
52102227Smike#define	I386_SET_GSBASE		10
53102227Smike
54102227Smike/* Leave space for 0-127 for to avoid translating syscalls */
55102227Smike#define	AMD64_GET_FSBASE	128
56102227Smike#define	AMD64_SET_FSBASE	129
57102227Smike#define	AMD64_GET_GSBASE	130
58102227Smike#define	AMD64_SET_GSBASE	131
59102227Smike
60102227Smikestruct i386_ldt_args {
61102227Smike	unsigned int start;
62102227Smike	struct user_segment_descriptor *descs __packed;
63102227Smike	unsigned int num;
64127239Smarcel};
65102227Smike
66114349Speterstruct i386_ioperm_args {
67175398Sbde	unsigned int start;
68102227Smike	unsigned int length;
69102227Smike	int	enable;
70102227Smike};
71102227Smike
72102227Smike#ifndef _KERNEL
73102227Smike__BEGIN_DECLS
74102227Smikeint amd64_get_fsbase(void **);
75102227Smikeint amd64_get_gsbase(void **);
76102227Smikeint amd64_set_fsbase(void *);
77102227Smikeint amd64_set_gsbase(void *);
78102227Smikeint sysarch(int, void *);
79102227Smike__END_DECLS
80102227Smike#else
81102227Smikestruct thread;
82102227Smikeunion descriptor;
83102227Smike
84114349Speterint amd64_get_ldt(struct thread *, struct i386_ldt_args *);
85102227Smikeint amd64_set_ldt(struct thread *, struct i386_ldt_args *,
86102227Smike    struct user_segment_descriptor *);
87102227Smikeint amd64_get_ioperm(struct thread *, struct i386_ioperm_args *);
88102227Smikeint amd64_set_ioperm(struct thread *, struct i386_ioperm_args *);
89102227Smike#endif
90102227Smike
91102227Smike#endif /* !_MACHINE_SYSARCH_H_ */
92102227Smike