kernel: Use hashdestroy() to free hash tables allocated with hashinit().
[dragonfly.git] / usr.bin / doscmd / doscmd.h
CommitLineData
984263bc
MD
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: src/usr.bin/doscmd/doscmd.h,v 1.7.2.1 2002/04/25 11:04:51 tg Exp $
1de703da 33 * $DragonFly: src/usr.bin/doscmd/doscmd.h,v 1.2 2003/06/17 04:29:26 dillon Exp $
984263bc
MD
34 */
35
36
37#ifdef __NetBSD__
38#define USE_VM86
39#endif
40
41#include <sys/param.h>
42#include <sys/types.h>
43#include <sys/time.h>
44#include <sys/stat.h>
45
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>
54
55#include <sys/signalvar.h>
56#include <machine/sigframe.h>
57
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
64
65#include "register.h"
66#include "dos.h"
67#include "callback.h"
68
69#define drlton(a) ((islower((a)) ? toupper((a)) : (a)) - 'A')
70#define drntol(a) ((a) + 'A')
71
72/*
73** assorted hardware/scope constants
74*/
75
76#define MAX_AVAIL_SEG 0xa000
77
78#define MAXPORT 0x400
79
80#define N_PARALS_MAX 3
81#define N_COMS_MAX 4 /* DOS restriction (sigh) */
82
83struct 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 */
88};
89extern struct vconnect_area vconnect_area;
90#define IntState vconnect_area.int_state
91
92/* ParseBuffer.c */
93int ParseBuffer(char *, char **, int);
94
95/* bios.c */
96#define BIOSDATA ((u_char *)0x400)
97extern unsigned long rom_config;
98extern int nfloppies;
99extern int ndisks;
100extern int nserial;
101extern int nparallel;
102
103extern volatile int poll_cnt;
104void bios_init(void);
105void wakeup_poll(void);
106void reset_poll(void);
107void sleep_poll(void);
108
109/* cmos.c */
110extern time_t delta_clock;
111
112void cmos_init(void);
113
114/* config.c */
115int read_config(FILE *fp);
116
117/* cpu.c */
118void cpu_init(void);
119int emu_instr(regcontext_t *);
120void int00(regcontext_t *);
121void int01(regcontext_t *);
122void int03(regcontext_t *);
123void int0d(regcontext_t *);
124
125/* debug.c */
126extern int vflag;
127extern int tmode;
128extern FILE *debugf;
129extern int debug_flags;
130
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 */
151
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 */
158
159#define TTYF_ALL (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT)
160#define TTYF_BLOCKALL (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT | TTYF_BLOCK)
161
162void unknown_int2(int, int, regcontext_t *);
163void unknown_int3(int, int, int, regcontext_t *);
164void unknown_int4(int, int, int, int, regcontext_t *);
165void fatal(const char *, ...) __printflike(1, 2);
166void debug(int, const char *, ...) __printflike(2, 3);
167void dump_regs(regcontext_t *);
168void debug_set(int);
169void debug_unset(int);
170u_long debug_isset(int);
171
172/* disktab.c */
173int map_type(int, int *, int *, int *);
174
175/* doscmd.c */
176extern int capture_fd;
177extern int dead;
178extern int xmode;
179extern int booting;
180extern int raw_kbd;
181extern int timer_disable;
182extern char cmdname[];
183extern struct timeval boot_time;
184extern unsigned long *ivec;
185
186int _prog(char *);
187void call_on_quit(void (*)(void *), void *);
188void done(regcontext_t *, int);
189void iomap_port(int, int);
190int open_prog(char *);
191void put_dosenv(const char *);
192void quit(int);
193int squirrel_fd(int);
194
195/* ems.c */
196int ems_init(void);
197void ems_entry(regcontext_t *);
198
199/* emuint.c */
200extern void emuint(regcontext_t *REGS);
201
202/* i386-pinsn.c */
203extern int i386dis(unsigned short, unsigned short,
204 unsigned char *, char *, int);
205
206/* int.c */
207void init_ints(void);
208int isinhardint(int);
209void softint(int);
210void hardint(int);
211void resume_interrupt(void);
212void unpend(int);
213void send_eoi(void);
214void set_eoir(int, void (*)(void *), void *);
215
216/* int10.c */
217extern void int10(regcontext_t *);
218
219/* int13.c */
220extern int init_hdisk(int drive, int cyl, int head, int tracksize,
221 char *file, char *boot_sector);
222extern int init_floppy(int drive, int type, char *file);
223extern int disk_fd(int drive);
224extern void make_readonly(int drive);
225extern int search_floppy(int i);
226extern void disk_bios_init(void);
227
228/* int16.c */
229void int16(regcontext_t *);
230
231/* int17.c */
232void int17(regcontext_t *);
233void lpt_poll(void);
234void printer_direct(int printer);
235void printer_spool(int printer, char *print_queue);
236void printer_timeout(int printer, char *time_out);
237
238/* int1a.c */
239void int1a(regcontext_t *);
240
241/* int2f.c */
242extern void int2f(regcontext_t *);
243
244/* intff.c */
245extern int int2f_11(regcontext_t *REGS);
246extern void intff(regcontext_t *REGS);
247
248/* mem.c */
249extern char *dosmem;
250
251extern void mem_init(void);
252extern int mem_alloc(int size, int owner, int *biggestp);
253extern int mem_adjust(int addr, int size, int *availp);
254extern void mem_free_owner(int owner);
255extern void mem_change_owner(int addr, int owner);
256
257/* mouse.c */
258void int33(regcontext_t *);
259void mouse_init(void);
260
261/* net.c */
262void net_init(void);
263
264/* port.c */
265void define_input_port_handler(int, unsigned char (*)(int));
266void define_output_port_handler(int, void (*)(int, unsigned char));
267void inb(regcontext_t *, int);
268unsigned char inb_port(int);
269unsigned char inb_speaker(int);
270unsigned char inb_traceport(int);
271void init_io_port_handlers(void);
272void insb(regcontext_t *, int);
273void insx(regcontext_t *, int);
274void inx(regcontext_t *, int);
275void outb(regcontext_t *, int);
276void outb_port(int, unsigned char);
277void outb_speaker(int, unsigned char);
278void outb_traceport(int, unsigned char);
279void outsb(regcontext_t *, int);
280void outsx(regcontext_t *, int);
281void outx(regcontext_t *, int);
282void speaker_init(void);
283
284/* setver.c */
285extern void setver(char *, short);
286extern short getver(char *);
287
288/* signal.c */
289extern struct sigframe *saved_sigframe;
290extern regcontext_t *saved_regcontext;
291extern int saved_valid;
292extern void setsignal(int s, void (*h)(struct sigframe *));
293
294/* timer.c */
295extern void timer_init(void);
296
297/* trace.c */
298extern int resettrace(regcontext_t *);
299extern void tracetrap(regcontext_t *);
300
301/* xms.c */
302extern void get_raw_extmemory_info(regcontext_t *REGS);
303extern int int2f_43(regcontext_t *REGS);
304extern void initHMA(void);
305extern void xms_init(void);
306extern u_long xms_maxsize;
307
308/****************************** dirty below here *****************************/extern int nmice;