Minimal changes to get m6502 to compile (won't work)
[Apout.git] / v7trap.h
1 /* v7trap.h - Deal with V7 trap instructions. Also do V5 and V6 syscalls.
2  *
3  * $Revision: 2.17 $
4  * $Date: 1999/12/26 08:16:33 $
5  */
6
7 /* In this file, we list the trap number for each system call,
8  * and the structures associated with several of the systems
9  * calls in 7th Edition UNIX
10  */
11
12 #define S_INDIR         0
13 #define S_EXIT          1
14 #define S_FORK          2
15 #define S_READ          3
16 #define S_WRITE         4
17 #define S_OPEN          5
18 #define S_CLOSE         6
19 #define S_WAIT          7
20 #define S_CREAT         8
21 #define S_LINK          9
22 #define S_UNLINK        10
23 #define S_EXEC          11
24 #define S_CHDIR         12
25 #define S_TIME          13
26 #define S_MKNOD         14
27 #define S_CHMOD         15
28 #define S_CHOWN         16
29 #define S_BREAK         17
30 #define S_STAT          18
31 #define S_LSEEK         19
32 #define S_GETPID        20
33 #define S_MOUNT         21
34 #define S_UMOUNT        22
35 #define S_SETUID        23
36 #define S_GETUID        24
37 #define S_STIME         25
38 #define S_PTRACE        26
39 #define S_ALARM         27
40 #define S_FSTAT         28
41 #define S_PAUSE         29
42 #define S_UTIME         30
43 #define S_STTY          31
44 #define S_GTTY          32
45 #define S_ACCESS        33
46 #define S_NICE          34
47 #define S_FTIME         35
48 #define S_SYNC          36
49 #define S_KILL          37
50 #define S_DUP           41
51 #define S_PIPE          42
52 #define S_TIMES         43
53 #define S_PROF          44
54 #define S_SETGID        46
55 #define S_GETGID        47
56 #define S_SIGNAL        48
57 #define S_ACCT          51
58 #define S_PHYS          52
59 #define S_LOCK          53
60 #define S_IOCTL         54
61 #define S_EXECE         59
62 #define S_UMASK         60
63 #define S_CHROOT        61
64
65
66 char *v7trap_name[] = {
67     "indir",
68     "exit",
69     "fork",
70     "read",
71     "write",
72     "open",
73     "close",
74     "wait",
75     "creat",
76     "link",
77     "unlink",
78     "exec",
79     "chdir",
80     "time",
81     "mknod",
82     "chmod",
83     "chown",
84     "break",
85     "stat",
86     "lseek",
87     "getpid",
88     "mount",
89     "umount",
90     "setuid",
91     "getuid",
92     "stime",
93     "ptrace",
94     "alarm",
95     "fstat",
96     "pause",
97     "utime",
98     "stty",
99     "gtty",
100     "access",
101     "nice",
102     "ftime",
103     "sync",
104     "kill",
105     "unknown",
106     "unknown",
107     "unknown",
108     "dup",
109     "pipe",
110     "times",
111     "prof",
112     "unknown",
113     "setgid",
114     "getgid",
115     "signal",
116     "unknown",
117     "unknown",
118     "acct",
119     "phys",
120     "lock",
121     "ioctl",
122     "unknown",
123     "unknown",
124     "unknown",
125     "unknown",
126     "exece",
127     "umask",
128     "chroot"
129 };
130
131
132 struct tr_v7stat {
133     int16_t st_dev;
134     u_int16_t st_ino;
135     u_int16_t st_mode;
136     int16_t st_nlink;
137     int16_t st_uid;
138     int16_t st_gid;
139     int16_t st_rdev;
140     int8_t st_size[4];          /* Alignment problems */
141     int8_t st_atim[4];          /* Alignment problems */
142     int8_t st_mtim[4];          /* Alignment problems */
143     int8_t st_ctim[4];          /* Alignment problems */
144 };
145
146 struct tr_v6stat {
147     int16_t idev;               /* Device */
148     int16_t inum;
149     int16_t iflags;             /* Mode */
150     int8_t inl;                 /* Links */
151     int8_t iuid;
152     int8_t igid;
153     u_int8_t isize0;            /* Most significant 8 bits */
154     u_int16_t isize;
155     int16_t iaddr[8];           /* Not used, I hope! */
156     u_int32_t atime;            /* Alignment problems */
157     u_int32_t mtime;            /* Alignment problems */
158 };
159
160 struct tr_timeb {
161     u_int32_t time;
162     u_int16_t millitm;
163     int16_t timezone;
164     int16_t dstflag;
165 };
166
167 struct tr_sgttyb {
168     int8_t sg_ispeed;           /* input speed */
169     int8_t sg_ospeed;           /* output speed */
170     int8_t sg_erase;            /* erase character */
171     int8_t sg_kill;             /* kill character */
172     int16_t sg_flags;           /* mode flags */
173 };
174
175 /*
176  * Values for sg_flags
177  */
178 #define TR_TANDEM  01
179 #define TR_CBREAK  02
180 #define TR_LCASE   04
181 #define TR_ECHO    010
182 #define TR_CRMOD   020
183 #define TR_RAW     040
184 #define TR_ODDP    0100
185 #define TR_EVENP   0200
186 #define TR_ANYP    0300
187 #define TR_XTABS   06000
188
189 /*
190  * Values for signal
191  */
192 #define V7_SIG_DFL 0
193 #define V7_SIG_IGN 1
194
195 #define V7_NSIG 15
196
197 #define V7_SIGHUP  1            /* hangup */
198 #define V7_SIGINT  2            /* interrupt */
199 #define V7_SIGQUIT 3            /* quit */
200 #define V7_SIGILL  4            /* illegal instruction (not reset when caught) */
201 #define V7_SIGTRAP 5            /* trace trap (not reset when caught) */
202 #define V7_SIGIOT  6            /* IOT instruction */
203 #define V7_SIGEMT  7            /* EMT instruction */
204 #define V7_SIGFPE  8            /* floating point exception */
205 #define V7_SIGKILL 9            /* kill (cannot be caught or ignored) */
206 #define V7_SIGBUS  10           /* bus error */
207 #define V7_SIGSEGV 11           /* segmentation violation */
208 #define V7_SIGSYS  12           /* bad argument to system call */
209 #define V7_SIGPIPE 13           /* write on a pipe with no one to read it */
210 #define V7_SIGALRM 14           /* alarm clock */
211 #define V7_SIGTERM 15           /* software termination signal from kill */
212
213
214 /* A union which will point at the trap args, so that
215  * we can get at the various args of different types
216  */
217 typedef union {
218     int16_t sarg[4];            /* Signed 16-bit args */
219     u_int16_t uarg[4];          /* Unsigned 16-bit args */
220 } arglist;
221
222 #define sarg1   V7A.sarg[0]
223 #define sarg2   V7A.sarg[1]
224 #define sarg3   V7A.sarg[2]
225 #define sarg4   V7A.sarg[3]
226 #define uarg1   V7A.uarg[0]
227 #define uarg2   V7A.uarg[1]
228 #define uarg3   V7A.uarg[2]
229 #define uarg4   V7A.uarg[3]