Remove warning flags and raise WARNS where possible.
[dragonfly.git] / usr.bin / doscmd / doscmd.h
blob44a6ef0e8870e80faa5856494f51c977ff733ce9
1 /*
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
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.
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.
30 * BSDI doscmd.h,v 2.3 1996/04/08 19:32:32 bostic Exp
32 * $FreeBSD: src/usr.bin/doscmd/doscmd.h,v 1.7.2.1 2002/04/25 11:04:51 tg Exp $
33 * $DragonFly: src/usr.bin/doscmd/doscmd.h,v 1.2 2003/06/17 04:29:26 dillon Exp $
37 #ifdef __NetBSD__
38 #define USE_VM86
39 #endif
41 #include <sys/param.h>
42 #include <sys/types.h>
43 #include <sys/time.h>
44 #include <sys/stat.h>
46 #include <dirent.h>
47 #include <fcntl.h>
48 #include <signal.h>
49 #include <stdio.h>
50 #include <stdlib.h>
51 #include <string.h>
52 #include <ucontext.h>
53 #include <errno.h>
55 #include <sys/signalvar.h>
56 #include <machine/sigframe.h>
58 #include <machine/frame.h>
59 #include <machine/psl.h>
60 #include <machine/npx.h>
61 #ifdef USE_VM86
62 #include <machine/vm86.h>
63 #endif
65 #include "register.h"
66 #include "dos.h"
67 #include "callback.h"
69 #define drlton(a) ((islower((a)) ? toupper((a)) : (a)) - 'A')
70 #define drntol(a) ((a) + 'A')
72 /*
73 ** assorted hardware/scope constants
76 #define MAX_AVAIL_SEG 0xa000
78 #define MAXPORT 0x400
80 #define N_PARALS_MAX 3
81 #define N_COMS_MAX 4 /* DOS restriction (sigh) */
83 struct vconnect_area {
84 int int_state;
85 int magic; /* 0x4242 -> PRB format */
86 u_long passthru[256>>5]; /* bitmap of INTs to handle */
87 u_long magiciret[2]; /* Bounds of "magic" IRET */
89 extern struct vconnect_area vconnect_area;
90 #define IntState vconnect_area.int_state
92 /* ParseBuffer.c */
93 int ParseBuffer(char *, char **, int);
95 /* bios.c */
96 #define BIOSDATA ((u_char *)0x400)
97 extern unsigned long rom_config;
98 extern int nfloppies;
99 extern int ndisks;
100 extern int nserial;
101 extern int nparallel;
103 extern volatile int poll_cnt;
104 void bios_init(void);
105 void wakeup_poll(void);
106 void reset_poll(void);
107 void sleep_poll(void);
109 /* cmos.c */
110 extern time_t delta_clock;
112 void cmos_init(void);
114 /* config.c */
115 int read_config(FILE *fp);
117 /* cpu.c */
118 void cpu_init(void);
119 int emu_instr(regcontext_t *);
120 void int00(regcontext_t *);
121 void int01(regcontext_t *);
122 void int03(regcontext_t *);
123 void int0d(regcontext_t *);
125 /* debug.c */
126 extern int vflag;
127 extern int tmode;
128 extern FILE *debugf;
129 extern int debug_flags;
131 /* Lower 8 bits are int number */
132 #define D_ALWAYS 0x0000100 /* always emit this message */
133 #define D_TRAPS 0x0000200 /* trap-related activity */
134 #define D_FILE_OPS 0x0000400 /* file-related activity */
135 #define D_MEMORY 0x0000800 /* memory-related activity */
136 #define D_HALF 0x0001000 /* "half-implemented" system calls */
137 #define D_FLOAT 0x0002000 /* ??? */
138 #define D_DISK 0x0004000 /* disk (not file) operations */
139 #define D_TRAPS2 0x0008000
140 #define D_PORT 0x0010000 /* port accesses */
141 #define D_EXEC 0x0020000
142 #define D_ITRAPS 0x0040000
143 #define D_REDIR 0x0080000 /* redirector functions */
144 #define D_PRINTER 0x0100000
145 #define D_TRAPS3 0x0200000
146 #define D_DEBUGIN 0x0400000
147 #define D_DOSCALL 0x0800000 /* MS-DOS function results */
148 #define D_XMS 0x1000000 /* XMS calls */
149 #define D_EMS 0x2000000 /* EMS calls */
150 #define D_VIDEO 0x4000000 /* video-related activity */
152 #define TTYF_ECHO 0x00000001
153 #define TTYF_ECHONL 0x00000003
154 #define TTYF_CTRL 0x00000004
155 #define TTYF_BLOCK 0x00000008
156 #define TTYF_POLL 0x00000010
157 #define TTYF_REDIRECT 0x00010000 /* Cannot have 0xffff bits set */
159 #define TTYF_ALL (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT)
160 #define TTYF_BLOCKALL (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT | TTYF_BLOCK)
162 void unknown_int2(int, int, regcontext_t *);
163 void unknown_int3(int, int, int, regcontext_t *);
164 void unknown_int4(int, int, int, int, regcontext_t *);
165 void fatal(const char *, ...) __printflike(1, 2);
166 void debug(int, const char *, ...) __printflike(2, 3);
167 void dump_regs(regcontext_t *);
168 void debug_set(int);
169 void debug_unset(int);
170 u_long debug_isset(int);
172 /* disktab.c */
173 int map_type(int, int *, int *, int *);
175 /* doscmd.c */
176 extern int capture_fd;
177 extern int dead;
178 extern int xmode;
179 extern int booting;
180 extern int raw_kbd;
181 extern int timer_disable;
182 extern char cmdname[];
183 extern struct timeval boot_time;
184 extern unsigned long *ivec;
186 int _prog(char *);
187 void call_on_quit(void (*)(void *), void *);
188 void done(regcontext_t *, int);
189 void iomap_port(int, int);
190 int open_prog(char *);
191 void put_dosenv(const char *);
192 void quit(int);
193 int squirrel_fd(int);
195 /* ems.c */
196 int ems_init(void);
197 void ems_entry(regcontext_t *);
199 /* emuint.c */
200 extern void emuint(regcontext_t *REGS);
202 /* i386-pinsn.c */
203 extern int i386dis(unsigned short, unsigned short,
204 unsigned char *, char *, int);
206 /* int.c */
207 void init_ints(void);
208 int isinhardint(int);
209 void softint(int);
210 void hardint(int);
211 void resume_interrupt(void);
212 void unpend(int);
213 void send_eoi(void);
214 void set_eoir(int, void (*)(void *), void *);
216 /* int10.c */
217 extern void int10(regcontext_t *);
219 /* int13.c */
220 extern int init_hdisk(int drive, int cyl, int head, int tracksize,
221 char *file, char *boot_sector);
222 extern int init_floppy(int drive, int type, char *file);
223 extern int disk_fd(int drive);
224 extern void make_readonly(int drive);
225 extern int search_floppy(int i);
226 extern void disk_bios_init(void);
228 /* int16.c */
229 void int16(regcontext_t *);
231 /* int17.c */
232 void int17(regcontext_t *);
233 void lpt_poll(void);
234 void printer_direct(int printer);
235 void printer_spool(int printer, char *print_queue);
236 void printer_timeout(int printer, char *time_out);
238 /* int1a.c */
239 void int1a(regcontext_t *);
241 /* int2f.c */
242 extern void int2f(regcontext_t *);
244 /* intff.c */
245 extern int int2f_11(regcontext_t *REGS);
246 extern void intff(regcontext_t *REGS);
248 /* mem.c */
249 extern char *dosmem;
251 extern void mem_init(void);
252 extern int mem_alloc(int size, int owner, int *biggestp);
253 extern int mem_adjust(int addr, int size, int *availp);
254 extern void mem_free_owner(int owner);
255 extern void mem_change_owner(int addr, int owner);
257 /* mouse.c */
258 void int33(regcontext_t *);
259 void mouse_init(void);
261 /* net.c */
262 void net_init(void);
264 /* port.c */
265 void define_input_port_handler(int, unsigned char (*)(int));
266 void define_output_port_handler(int, void (*)(int, unsigned char));
267 void inb(regcontext_t *, int);
268 unsigned char inb_port(int);
269 unsigned char inb_speaker(int);
270 unsigned char inb_traceport(int);
271 void init_io_port_handlers(void);
272 void insb(regcontext_t *, int);
273 void insx(regcontext_t *, int);
274 void inx(regcontext_t *, int);
275 void outb(regcontext_t *, int);
276 void outb_port(int, unsigned char);
277 void outb_speaker(int, unsigned char);
278 void outb_traceport(int, unsigned char);
279 void outsb(regcontext_t *, int);
280 void outsx(regcontext_t *, int);
281 void outx(regcontext_t *, int);
282 void speaker_init(void);
284 /* setver.c */
285 extern void setver(char *, short);
286 extern short getver(char *);
288 /* signal.c */
289 extern struct sigframe *saved_sigframe;
290 extern regcontext_t *saved_regcontext;
291 extern int saved_valid;
292 extern void setsignal(int s, void (*h)(struct sigframe *));
294 /* timer.c */
295 extern void timer_init(void);
297 /* trace.c */
298 extern int resettrace(regcontext_t *);
299 extern void tracetrap(regcontext_t *);
301 /* xms.c */
302 extern void get_raw_extmemory_info(regcontext_t *REGS);
303 extern int int2f_43(regcontext_t *REGS);
304 extern void initHMA(void);
305 extern void xms_init(void);
306 extern u_long xms_maxsize;
308 /****************************** dirty below here *****************************/extern int nmice;