bbf1dfd355bed25bc3ad4851d0a2d7cd71ecca63
[dragonfly.git] / sys / emulation / svr4 / i386 / svr4_machdep.h
1 /*
2  * Copyright (c) 1998 Mark Newton
3  * Copyright (c) 1994 Christos Zoulas
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * $FreeBSD: src/sys/i386/svr4/svr4_machdep.h,v 1.6 2000/01/09 09:57:19 bde Exp $
29  * $DragonFly: src/sys/emulation/svr4/i386/Attic/svr4_machdep.h,v 1.3 2003/08/07 21:17:20 dillon Exp $
30  */
31
32 #ifndef _I386_SVR4_MACHDEP_H_
33 #define _I386_SVR4_MACHDEP_H_
34
35 #if !defined(SVR4_MACHDEP_JUST_REGS)
36 #include <sys/signal.h>
37 #include "../svr4_types.h"
38 #endif
39
40 /*
41  * Machine dependent portions [X86]
42  */
43
44 #define SVR4_X86_GS     0
45 #define SVR4_X86_FS     1
46 #define SVR4_X86_ES     2
47 #define SVR4_X86_DS     3
48 #define SVR4_X86_EDI    4
49 #define SVR4_X86_ESI    5
50 #define SVR4_X86_EBP    6
51 #define SVR4_X86_ESP    7
52 #define SVR4_X86_EBX    8
53 #define SVR4_X86_EDX    9
54 #define SVR4_X86_ECX    10
55 #define SVR4_X86_EAX    11
56 #define SVR4_X86_TRAPNO 12
57 #define SVR4_X86_ERR    13
58 #define SVR4_X86_EIP    14
59 #define SVR4_X86_CS     15
60 #define SVR4_X86_EFL    16
61 #define SVR4_X86_UESP   17
62 #define SVR4_X86_SS     18
63 #define SVR4_X86_MAXREG 19
64
65
66 #if !defined(SVR4_MACHDEP_JUST_REGS)
67 typedef int svr4_greg_t;
68 typedef svr4_greg_t svr4_gregset_t[SVR4_X86_MAXREG];
69
70 typedef struct {
71     int         f_x87[62];      /* x87 registers */
72     long        f_weitek[33];   /* weitek */
73 } svr4_fregset_t;
74
75 struct proc;
76 struct svr4_ucontext;
77
78 void svr4_getcontext __P((struct proc *, struct svr4_ucontext *,
79                           sigset_t *, int));
80 int svr4_setcontext __P((struct proc *p, struct svr4_ucontext *));
81
82 typedef struct {
83         svr4_gregset_t  greg;
84         svr4_fregset_t  freg;
85 } svr4_mcontext_t;
86
87 /*
88  * SYSARCH numbers
89  */
90 #define SVR4_SYSARCH_FPHW       40
91 #define SVR4_SYSARCH_DSCR       75
92
93 struct svr4_ssd {
94         unsigned int selector;
95         unsigned int base;
96         unsigned int limit;
97         unsigned int access1;
98         unsigned int access2;
99 };
100
101 /*
102  * Processor traps
103  */
104 #define SVR4_T_DIVIDE           0
105 #define SVR4_T_TRCTRAP          1
106 #define SVR4_T_NMI              2
107 #define SVR4_T_BPTFLT           3
108 #define SVR4_T_OFLOW            4
109 #define SVR4_T_BOUND            5
110 #define SVR4_T_PRIVINFLT        6
111 #define SVR4_T_DNA              7
112 #define SVR4_T_DOUBLEFLT        8
113 #define SVR4_T_FPOPFLT          9
114 #define SVR4_T_TSSFLT           10
115 #define SVR4_T_SEGNPFLT         11
116 #define SVR4_T_STKFLT           12
117 #define SVR4_T_PROTFLT          13
118 #define SVR4_T_PAGEFLT          14
119 #define SVR4_T_ALIGNFLT         17
120
121 #endif /* !SVR4_MACHDEP_JUST_REGS */
122 #endif /* !_I386_SVR4_MACHDEP_H_ */