xref: /minix3/sys/arch/i386/include/svr4_machdep.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 /*	$NetBSD: svr4_machdep.h,v 1.16 2008/04/28 20:23:24 martin Exp $	 */
2 
3 /*-
4  * Copyright (c) 1994 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Christos Zoulas.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef	_I386_SVR4_MACHDEP_H_
33 #define	_I386_SVR4_MACHDEP_H_
34 
35 #include <compat/svr4/svr4_types.h>
36 
37 /*
38  * Machine dependent portions [X86]
39  */
40 
41 #define SVR4_X86_GS	0
42 #define SVR4_X86_FS	1
43 #define SVR4_X86_ES	2
44 #define SVR4_X86_DS	3
45 #define SVR4_X86_EDI	4
46 #define SVR4_X86_ESI	5
47 #define SVR4_X86_EBP	6
48 #define SVR4_X86_ESP	7
49 #define SVR4_X86_EBX	8
50 #define SVR4_X86_EDX	9
51 #define SVR4_X86_ECX	10
52 #define SVR4_X86_EAX	11
53 #define SVR4_X86_TRAPNO	12
54 #define SVR4_X86_ERR	13
55 #define SVR4_X86_EIP	14
56 #define SVR4_X86_CS	15
57 #define SVR4_X86_EFL	16
58 #define SVR4_X86_UESP	17
59 #define SVR4_X86_SS	18
60 #define SVR4_X86_MAXREG	19
61 
62 
63 typedef int svr4_greg_t;
64 typedef svr4_greg_t svr4_gregset_t[SVR4_X86_MAXREG];
65 
66 typedef struct {
67     int		f_x87[62];	/* x87 registers */
68     long	f_weitek[33]; 	/* weitek */
69 } svr4_fregset_t;
70 
71 struct svr4_mcontext;
72 
73 typedef struct svr4_mcontext {
74 	svr4_gregset_t	greg;
75 	svr4_fregset_t	freg;
76 } svr4_mcontext_t;
77 
78 #define SVR4_UC_MACHINE_PAD	5
79 
80 /*
81  * SYSARCH numbers
82  */
83 #define SVR4_SYSARCH_FPHW	40
84 #define SVR4_SYSARCH_DSCR	75
85 
86 struct svr4_ssd {
87 	unsigned int selector;
88 	unsigned int base;
89 	unsigned int limit;
90 	unsigned int access1;
91 	unsigned int access2;
92 };
93 
94 /*
95  * Processor traps
96  */
97 #define	SVR4_T_DIVIDE		0
98 #define	SVR4_T_TRCTRAP		1
99 #define	SVR4_T_NMI		2
100 #define	SVR4_T_BPTFLT		3
101 #define	SVR4_T_OFLOW		4
102 #define	SVR4_T_BOUND		5
103 #define	SVR4_T_PRIVINFLT	6
104 #define	SVR4_T_DNA		7
105 #define	SVR4_T_DOUBLEFLT	8
106 #define	SVR4_T_FPOPFLT		9
107 #define	SVR4_T_TSSFLT		10
108 #define	SVR4_T_SEGNPFLT		11
109 #define	SVR4_T_STKFLT		12
110 #define	SVR4_T_PROTFLT		13
111 #define	SVR4_T_PAGEFLT		14
112 #define	SVR4_T_ALIGNFLT		17
113 
114 /*
115  * Fast syscall gate traps.
116  */
117 #define	SVR4_TRAP_FNULL		0	/* Null trap, for testing */
118 #define	SVR4_TRAP_FGETFP	1	/* Get emulated FP context */
119 #define	SVR4_TRAP_FSETFP	2	/* Set emulated FP context */
120 #define	SVR4_TRAP_GETHRTIME	3	/* implements gethrtime(2) */
121 #define	SVR4_TRAP_GETHRVTIME	4	/* implements gethrvtime(2) */
122 #define	SVR4_TRAP_GETHRESTIME	5	/* clock_gettime(CLOCK_REALTIME, tp) */
123 
124 void svr4_syscall_intern(struct proc *);
125 
126 #endif /* !_I386_SVR4_MACHDEP_H_ */
127