2 * Copyright (c) 1992, 1993, 1996
3 * Berkeley Software Design, Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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
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
30 * BSDI doscmd.h,v 2.3 1996/04/08 19:32:32 bostic Exp
40 #include <sys/param.h>
41 #include <sys/types.h>
53 #include <sys/signalvar.h>
54 #include <machine/sigframe.h>
56 #include <machine/frame.h>
57 #include <machine/psl.h>
58 #include <machine/npx.h>
60 #include <machine/vm86.h>
67 #define drlton(a) ((islower((a)) ? toupper((a)) : (a)) - 'A')
68 #define drntol(a) ((a) + 'A')
71 ** assorted hardware/scope constants
74 #define MAX_AVAIL_SEG 0xa000
78 #define N_PARALS_MAX 3
79 #define N_COMS_MAX 4 /* DOS restriction (sigh) */
81 struct vconnect_area {
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 */
87 extern struct vconnect_area vconnect_area;
88 #define IntState vconnect_area.int_state
91 extern int ParseBuffer(char *, char **, int);
94 #define BIOSDATA ((u_char *)0x400)
95 extern unsigned long rom_config;
101 extern volatile int poll_cnt;
102 extern void bios_init(void);
103 extern void wakeup_poll(void);
104 extern void reset_poll(void);
105 extern void sleep_poll(void);
108 extern time_t delta_clock;
110 extern void cmos_init(void);
113 extern int read_config(FILE *fp);
116 extern void cpu_init(void);
117 extern int emu_instr(regcontext_t *);
123 extern int debug_flags;
125 /* Lower 8 bits are int number */
126 #define D_ALWAYS 0x0000100 /* always emit this message */
127 #define D_TRAPS 0x0000200 /* trap-related activity */
128 #define D_FILE_OPS 0x0000400 /* file-related activity */
129 #define D_MEMORY 0x0000800 /* memory-related activity */
130 #define D_HALF 0x0001000 /* "half-implemented" system calls */
131 #define D_FLOAT 0x0002000 /* ??? */
132 #define D_DISK 0x0004000 /* disk (not file) operations */
133 #define D_TRAPS2 0x0008000
134 #define D_PORT 0x0010000 /* port accesses */
135 #define D_EXEC 0x0020000
136 #define D_ITRAPS 0x0040000
137 #define D_REDIR 0x0080000 /* redirector functions */
138 #define D_PRINTER 0x0100000
139 #define D_TRAPS3 0x0200000
140 #define D_DEBUGIN 0x0400000
141 #define D_DOSCALL 0x0800000 /* MS-DOS function results */
142 #define D_XMS 0x1000000 /* XMS calls */
143 #define D_EMS 0x2000000 /* EMS calls */
144 #define D_VIDEO 0x4000000 /* video-related activity */
146 #define TTYF_ECHO 0x00000001
147 #define TTYF_ECHONL 0x00000003
148 #define TTYF_CTRL 0x00000004
149 #define TTYF_BLOCK 0x00000008
150 #define TTYF_POLL 0x00000010
151 #define TTYF_REDIRECT 0x00010000 /* Cannot have 0xffff bits set */
153 #define TTYF_ALL (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT)
154 #define TTYF_BLOCKALL (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT | TTYF_BLOCK)
156 extern void unknown_int2(int, int, regcontext_t *REGS);
157 extern void unknown_int3(int, int, int, regcontext_t *REGS);
158 extern void unknown_int4(int, int, int, int, regcontext_t *REGS);
159 extern void fatal (char *fmt, ...);
160 extern void debug (int flags, char *fmt, ...);
161 extern void dump_regs(regcontext_t *REGS);
162 extern void debug_set(int x);
163 extern void debug_unset(int x);
164 extern u_long debug_isset(int x);
167 extern int map_type(int, int *, int *, int *);
170 extern int squirrel_fd(int);
172 extern int capture_fd;
177 extern int timer_disable;
178 extern char cmdname[];
179 extern struct timeval boot_time;
180 extern unsigned long *ivec;
182 extern int open_prog(char *name);
183 extern void done(regcontext_t *REGS, int val);
184 extern void quit(int);
185 extern void call_on_quit(void (*)(void *), void *);
186 extern void iomap_port(int port, int count);
189 extern int ems_init();
190 extern void ems_entry(regcontext_t *REGS);
191 extern u_long ems_frame_addr;
194 extern void emuint(regcontext_t *REGS);
197 extern int i386dis(unsigned short, unsigned short,
198 unsigned char *, char *, int);
201 extern void softint(int intnum);
202 extern void hardint(int intnum);
204 extern void delay_interrupt(int intnum, void (*func)(int));
205 extern void resume_interrupt(void);
208 extern void int10(regcontext_t *);
211 extern int init_hdisk(int drive, int cyl, int head, int tracksize,
212 char *file, char *boot_sector);
213 extern int init_floppy(int drive, int type, char *file);
214 extern int disk_fd(int drive);
215 extern void make_readonly(int drive);
216 extern int search_floppy(int i);
217 extern void disk_bios_init(void);
220 extern void lpt_poll(void);
221 extern void printer_direct(int printer);
222 extern void printer_spool(int printer, char *print_queue);
223 extern void printer_timeout(int printer, char *time_out);
226 extern void int2f(regcontext_t *);
229 extern int int2f_11(regcontext_t *REGS);
230 extern void intff(regcontext_t *REGS);
235 extern void mem_init(void);
236 extern int mem_alloc(int size, int owner, int *biggestp);
237 extern int mem_adjust(int addr, int size, int *availp);
238 extern void mem_free_owner(int owner);
239 extern void mem_change_owner(int addr, int owner);
242 extern void mouse_init(void);
245 extern void net_init(void);
248 extern void define_input_port_handler(int, unsigned char (*)(int));
249 extern void define_output_port_handler(int, void (*)(int, unsigned char));
250 extern void inb(regcontext_t *, int);
251 extern void init_io_port_handlers(void);
252 extern void inx(regcontext_t *, int);
253 extern void outb(regcontext_t *, int);
254 extern void outx(regcontext_t *, int);
255 extern void speaker_init(void);
256 extern void outb_traceport(int, unsigned char);
257 extern unsigned char inb_traceport(int);
258 extern void outb_port(int, unsigned char);
259 extern unsigned char inb_port(int);
262 extern void setver(char *, short);
263 extern short getver(char *);
266 extern struct sigframe *saved_sigframe;
267 extern regcontext_t *saved_regcontext;
268 extern int saved_valid;
269 extern void setsignal(int s, void (*h)(struct sigframe *));
272 extern void timer_init(void);
275 extern int resettrace(regcontext_t *);
276 extern void tracetrap(regcontext_t *);
279 extern void get_raw_extmemory_info(regcontext_t *REGS);
280 extern int int2f_43(regcontext_t *REGS);
281 extern void initHMA(void);
282 extern void xms_init(void);
283 extern u_long xms_maxsize;
285 /****************************** dirty below here *****************************/
287 extern u_long pending[]; /* pending interrupts */
288 extern int n_pending;
292 void put_dosenv(char *value);