]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/doscmd/doscmd.h
This commit was generated by cvs2svn to compensate for changes in r82498,
[FreeBSD/FreeBSD.git] / usr.bin / doscmd / doscmd.h
1 /*
2  * Copyright (c) 1992, 1993, 1996
3  *      Berkeley Software Design, Inc.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by Berkeley Software
16  *      Design, Inc.
17  *
18  * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  *      BSDI doscmd.h,v 2.3 1996/04/08 19:32:32 bostic Exp
31  *
32  * $FreeBSD$
33  */
34
35
36 #ifdef __NetBSD__
37 #define USE_VM86
38 #endif
39
40 #include <sys/param.h>
41 #include <sys/types.h>
42 #include <sys/time.h>
43 #include <sys/stat.h>
44
45 #include <dirent.h>
46 #include <fcntl.h>
47 #include <signal.h>
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <string.h>
51 #include <errno.h>
52
53 #include <sys/signalvar.h>
54 #include <machine/sigframe.h>
55
56 #include <machine/frame.h>
57 #include <machine/psl.h>
58 #include <machine/npx.h>
59 #ifdef USE_VM86
60 #include <machine/vm86.h>
61 #endif
62
63 #include "register.h"
64 #include "dos.h"
65 #include "callback.h"
66
67 #define drlton(a)       ((islower((a)) ? toupper((a)) : (a)) - 'A')
68 #define drntol(a)       ((a) + 'A')
69
70 /* 
71 ** assorted hardware/scope constants 
72 */
73
74 #define MAX_AVAIL_SEG   0xa000
75
76 #define MAXPORT         0x400
77
78 #define N_PARALS_MAX    3
79 #define N_COMS_MAX      4       /* DOS restriction (sigh) */
80
81 struct vconnect_area {
82         int     int_state;
83         int     magic;                  /* 0x4242 -> PRB format */
84         u_long  passthru[256>>5];       /* bitmap of INTs to handle */
85         u_long  magiciret[2];           /* Bounds of "magic" IRET */
86 };
87 extern struct vconnect_area vconnect_area;
88 #define IntState vconnect_area.int_state
89
90 /* ParseBuffer.c */
91 int     ParseBuffer(char *, char **, int);
92
93 /* bios.c */
94 #define BIOSDATA        ((u_char *)0x400)
95 extern unsigned long    rom_config;
96 extern int nfloppies;
97 extern int ndisks;
98 extern int nserial;
99 extern int nparallel;
100
101 extern volatile int     poll_cnt;
102 void    bios_init(void);
103 void    wakeup_poll(void);
104 void    reset_poll(void);
105 void    sleep_poll(void);
106
107 /* cmos.c */
108 extern time_t   delta_clock;
109
110 void    cmos_init(void);
111
112 /* config.c */
113 int     read_config(FILE *fp);
114
115 /* cpu.c */
116 void    cpu_init(void);
117 int     emu_instr(regcontext_t *);
118 void    int00(regcontext_t *);
119 void    int01(regcontext_t *);
120 void    int03(regcontext_t *);
121 void    int0d(regcontext_t *);
122
123 /* debug.c */
124 extern int      vflag;
125 extern int      tmode;
126 extern FILE     *debugf;
127 extern int      debug_flags;
128
129 /* Lower 8 bits are int number */
130 #define D_ALWAYS        0x0000100       /* always emit this message */
131 #define D_TRAPS         0x0000200       /* trap-related activity */
132 #define D_FILE_OPS      0x0000400       /* file-related activity */
133 #define D_MEMORY        0x0000800       /* memory-related activity */
134 #define D_HALF          0x0001000       /* "half-implemented" system calls */
135 #define D_FLOAT         0x0002000       /* ??? */
136 #define D_DISK          0x0004000       /* disk (not file) operations */
137 #define D_TRAPS2        0x0008000
138 #define D_PORT          0x0010000       /* port accesses */
139 #define D_EXEC          0x0020000
140 #define D_ITRAPS        0x0040000
141 #define D_REDIR         0x0080000       /* redirector functions */
142 #define D_PRINTER       0x0100000
143 #define D_TRAPS3        0x0200000
144 #define D_DEBUGIN       0x0400000
145 #define D_DOSCALL       0x0800000       /* MS-DOS function results */
146 #define D_XMS           0x1000000       /* XMS calls */
147 #define D_EMS           0x2000000       /* EMS calls */
148 #define D_VIDEO         0x4000000       /* video-related activity */
149
150 #define TTYF_ECHO       0x00000001
151 #define TTYF_ECHONL     0x00000003
152 #define TTYF_CTRL       0x00000004
153 #define TTYF_BLOCK      0x00000008
154 #define TTYF_POLL       0x00000010
155 #define TTYF_REDIRECT   0x00010000      /* Cannot have 0xffff bits set */
156
157 #define TTYF_ALL        (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT)
158 #define TTYF_BLOCKALL   (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT | TTYF_BLOCK)
159
160 void    unknown_int2(int, int, regcontext_t *);
161 void    unknown_int3(int, int, int, regcontext_t *);
162 void    unknown_int4(int, int, int, int, regcontext_t *);
163 void    fatal(const char *, ...) __printflike(1, 2);
164 void    debug(int, const char *, ...) __printflike(2, 3);
165 void    dump_regs(regcontext_t *);
166 void    debug_set(int);
167 void    debug_unset(int);
168 u_long  debug_isset(int);
169
170 /* disktab.c */
171 int     map_type(int, int *, int *, int *);
172
173 /* doscmd.c */
174 extern int              capture_fd;
175 extern int              dead;
176 extern int              xmode;
177 extern int              booting;
178 extern int              raw_kbd;
179 extern int              timer_disable;
180 extern char             cmdname[];
181 extern struct timeval   boot_time;
182 extern unsigned long    *ivec;
183
184 int     _prog(char *);
185 void    call_on_quit(void (*)(void *), void *);
186 void    done(regcontext_t *, int);
187 void    iomap_port(int, int);
188 int     open_prog(char *);
189 void    put_dosenv(const char *);
190 void    quit(int);
191 int     squirrel_fd(int);
192
193 /* ems.c */
194 int     ems_init(void);
195 void    ems_entry(regcontext_t *);
196
197 /* emuint.c */
198 extern void     emuint(regcontext_t *REGS);
199
200 /* i386-pinsn.c */
201 extern int      i386dis(unsigned short, unsigned short,
202     unsigned char *, char *, int);
203
204 /* int.c */
205 extern void     softint(int intnum);
206 extern void     hardint(int intnum);
207
208 extern void     delay_interrupt(int intnum, void (*func)(int));
209 extern void     resume_interrupt(void);
210
211 /* int10.c */
212 extern void     int10(regcontext_t *);
213
214 /* int13.c */
215 extern int      init_hdisk(int drive, int cyl, int head, int tracksize,
216                            char *file, char *boot_sector);
217 extern int      init_floppy(int drive, int type, char *file);
218 extern int      disk_fd(int drive);
219 extern void     make_readonly(int drive);
220 extern int      search_floppy(int i);
221 extern void     disk_bios_init(void);
222
223 /* int16.c */
224 void    int16(regcontext_t *);
225
226 /* int17.c */
227 void    int17(regcontext_t *);
228 void    lpt_poll(void);
229 void    printer_direct(int printer);
230 void    printer_spool(int printer, char *print_queue);
231 void    printer_timeout(int printer, char *time_out);
232
233 /* int1a.c */
234 void    int1a(regcontext_t *);
235
236 /* int2f.c */
237 extern void     int2f(regcontext_t *);
238
239 /* intff.c */
240 extern int      int2f_11(regcontext_t *REGS);
241 extern void     intff(regcontext_t *REGS);
242
243 /* mem.c */
244 extern char     *dosmem;
245
246 extern void     mem_init(void);
247 extern int      mem_alloc(int size, int owner, int *biggestp);
248 extern int      mem_adjust(int addr, int size, int *availp);
249 extern void     mem_free_owner(int owner);
250 extern void     mem_change_owner(int addr, int owner);
251
252 /* mouse.c */
253 void    int33(regcontext_t *);
254 void    mouse_init(void);
255
256 /* net.c */
257 void    net_init(void);
258
259 /* port.c */
260 void    define_input_port_handler(int, unsigned char (*)(int));
261 void    define_output_port_handler(int, void (*)(int, unsigned char));
262 void    inb(regcontext_t *, int);
263 unsigned char   inb_port(int);
264 unsigned char   inb_speaker(int);
265 unsigned char   inb_traceport(int);
266 void    init_io_port_handlers(void);
267 void    insb(regcontext_t *, int);
268 void    insx(regcontext_t *, int);
269 void    inx(regcontext_t *, int);
270 void    outb(regcontext_t *, int);
271 void    outb_port(int, unsigned char);
272 void    outb_speaker(int, unsigned char);
273 void    outb_traceport(int, unsigned char);
274 void    outsb(regcontext_t *, int);
275 void    outsx(regcontext_t *, int);
276 void    outx(regcontext_t *, int);
277 void    speaker_init(void);
278
279 /* setver.c */
280 extern void     setver(char *, short);
281 extern short    getver(char *);
282
283 /* signal.c */
284 extern struct sigframe  *saved_sigframe;
285 extern regcontext_t     *saved_regcontext;
286 extern int              saved_valid;
287 extern void             setsignal(int s, void (*h)(struct sigframe *));
288
289 /* timer.c */
290 extern void     timer_init(void);
291
292 /* trace.c */
293 extern int      resettrace(regcontext_t *);
294 extern void     tracetrap(regcontext_t *);
295
296 /* xms.c */
297 extern void     get_raw_extmemory_info(regcontext_t *REGS);
298 extern int      int2f_43(regcontext_t *REGS);
299 extern void     initHMA(void);
300 extern void     xms_init(void);
301 extern u_long   xms_maxsize;
302
303 /****************************** dirty below here *****************************/
304
305 extern u_long   pending[];              /* pending interrupts */
306 extern int      n_pending;
307
308 extern int nmice;