1 /* defines.h - Definitions of things needed in all C files
4 * $Date: 2008/05/19 13:42:39 $
17 /* Defines for ifdef'd code -- define them in the Makefile */
19 /* #define DEBUG adds in debugging code */
20 /* #define ZERO_MEMORY zeros all of process memory before
22 /* #define NATIVES allows native binaries and PDP-11
23 binaries in the filespace */
24 /* #define EMU211 add 2.11BSD emulation */
25 /* #define EMUV1 add 1st Edition emulation */
26 /* #define INLINE inline inlines some functions (needs gcc) */
29 /* Optimisation defines */
34 /* Special defines to enable/disable certain
35 * functionality. These are added as required
36 * to port to new platforms. Please send in new
40 #if defined(__FreeBSD__) && __FreeBSD__ < 3
45 #define Reboot(x) reboot(x)
52 #define NEED_MAP_FCNTL
58 #define VDSUSP VSUSP /* I don't think these are equivalent */
63 #if defined(__NetBSD__) || defined(__OpenBSD__)
64 #define Reboot(x) reboot(x,NULL)
68 #define Reboot(x) exit(0)
71 #if !defined(__FreeBSD__) && !defined(__NetBSD__) && \
72 !defined(__OpenBSD__) && !defined(__linux__) && !defined(__APPLE__)
76 /* Type definitions for PDP data types. You may need to
77 * define NEED_INT_N if your system doesn't provide the
78 * types defined below. If you do this, the best way is
79 * to add some #if .. #define .. #endif lines above,
80 * rather then modifying the ones below. If you make
81 * changes to the #if's above, then I would be very
82 * happy to include them.
84 * Warren Toomey: wkt@tuhs.org
89 typedef short int16_t;
91 typedef unsigned char u_int8_t;
92 typedef unsigned short u_int16_t;
93 typedef unsigned long u_int32_t;
96 /* Macro defines for debug output, makes
97 * the code look somewhat cleaner
101 #define TrapDebug(x) if (trap_debug) (void)fprintf x
102 #define InstDebug(x) if (inst_debug) (void)fprintf x
103 #define JsrDebug(x) if (jsr_debug) (void)fprintf x
104 #define FpDebug(x) if (fp_debug) (void)fprintf x
112 /* Defines for -DSTREAM_BUFFERING */
113 #define NFILE 40 /* Number of file pointers we can buffer */
114 #define ValidFD(x) ((x>=0) && (x<NFILE))
115 /* Used for opening on directories */
116 #define TMP_PLATE "/tmp/apout_tmp_dir.XXXXXX"
119 /* Set up prototype macro for
120 * both K&R and ANSI C platforms
128 #define MAX_ARGS 200 /* Max cmd-line args per process */
129 #define PDP_MEM_SIZE 65536 /* Size of inst-space and data-space */
130 extern u_int8_t *ispace, *dspace;
132 /* The following array holds the FILE pointers
133 * that correspond to open file descriptors.
134 * Only fds which are not ttys have
137 extern FILE *stream[NFILE];
138 extern char *streammode[NFILE];
140 extern int sig_arrived; /* Indicates if a signal has arrived */
141 extern int Argc, Envc; /* Arguments passed to new process */
142 extern char *Argv[MAX_ARGS], *Envp[MAX_ARGS];
143 extern int Binary; /* Type of binary this a.out is. One of: */
154 #define IS_211BSD 211
156 /* 2.11BSD overlay stuff */
157 extern u_int32_t ov_changes; /* Number of overlay changes */
158 extern u_int8_t current_ov; /* Current overlay number */
161 /* Debugging flags */
162 extern int inst_debug, /* Print a line before each instruction */
163 trap_debug, /* Print details of each trap */
164 jsr_debug, /* Print out each jsr */
165 fp_debug; /* Print out each floating-point instruction */
166 extern FILE *dbg_file; /* Debugging output file */
167 extern char *progname; /* The program's name - used in debugging */
170 /* We keep a list of signals that are pending */
172 int sig; /* Number of the signal */
173 struct our_siglist *next;
175 extern struct our_siglist *Sighead; /* Head of the list */
176 extern struct our_siglist *Sigtail; /* Tail of the list */
180 /* Function prototypes */
183 int load_a_out P((const char *file, const char *origpath, int want_env))
184 /*@globals errno,stdout,stderr; @ */ ;
186 void do_bsd_overlay P((void));
190 int main P((int argc, char **argv));
191 void usage P((void));
192 char *xlate_filename P((char *name));
193 void set_apout_root P((char *dirname));
196 int special_magic P((u_int16_t * cptr));
199 void v6trap P((void));
202 void v7trap P((void));
205 void v1trap P((void));
209 void bsdtrap P((void)) /*@globals errno,stdout,stderr; @ */ ;
212 int trap_ioctl P((void));
215 void set_bsdsig_dfl P((void));
216 int do_sigaction P((int sig, int a, int oa));
217 void sigcatcher P((int sig));
223 #include "pdp11/cpu.h"
226 #include "z180/cpu.h"