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