1 | /*
|
---|
2 | * mdb.h for mdb
|
---|
3 | */
|
---|
4 | #define MDBVERSION "2.6"
|
---|
5 | #define MDBBUILD 0
|
---|
6 |
|
---|
7 | #define MINIX_SYMBOLS 1
|
---|
8 | #define GNU_SYMBOLS 2
|
---|
9 |
|
---|
10 | /*
|
---|
11 | * Handle options here
|
---|
12 | */
|
---|
13 | #ifndef GNU_SUPPORT
|
---|
14 | #define GNU_SUPPORT 0
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | #ifndef SYSCALLS_SUPPORT
|
---|
18 | #define SYSCALLS_SUPPORT 0
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | #ifdef DEBUG
|
---|
22 | #undef DEBUG
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | #ifdef NDEBUG
|
---|
26 | #undef DEBUG
|
---|
27 | #else
|
---|
28 | #define DEBUG 1
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #ifdef __i386
|
---|
32 | #define EXTRA_SYMBOLS GNU_SUPPORT
|
---|
33 | #else
|
---|
34 | #define EXTRA_SYMBOLS 0
|
---|
35 | #endif
|
---|
36 |
|
---|
37 |
|
---|
38 | #include <minix/config.h>
|
---|
39 | #include <ansi.h>
|
---|
40 | #include <sys/types.h>
|
---|
41 |
|
---|
42 | #include <minix/const.h>
|
---|
43 | #include <minix/type.h>
|
---|
44 |
|
---|
45 | #include <limits.h>
|
---|
46 | #include <errno.h>
|
---|
47 | #include <minix/ipc.h>
|
---|
48 | #include <timers.h>
|
---|
49 |
|
---|
50 | #undef printf /* defined as printk in <minix/const.h> */
|
---|
51 |
|
---|
52 | #if (CHIP == M68000)
|
---|
53 | #define __mc68000__ /* controls processor-dependent stuff */
|
---|
54 | #if (MACHINE == ATARI)
|
---|
55 | #define MINIX_ST /* controls system-dependent stuff */
|
---|
56 | #else
|
---|
57 | #error "only the MINIX_ST 1.5.x implementation works on 68K's"
|
---|
58 | #endif
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | #if (CHIP == INTEL)
|
---|
62 | #if (MACHINE == IBM_PC)
|
---|
63 | #define MINIX_PC
|
---|
64 | #else
|
---|
65 | #error "only the MINIX_PC 1.5.x and later versions works on *86's"
|
---|
66 | #endif
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | #ifdef MINIX_ST
|
---|
70 | #define BP_OFF ((long)&((struct proc *)0)->p_reg.a6)
|
---|
71 | #define PC_MEMBER(rp) ((rp)->p_reg.pc)
|
---|
72 | #define PC_OFF ((long)&((struct proc *)0)->p_reg.pc)
|
---|
73 | #define SP_MEMBER(rp) ((rp)->p_reg.sp)
|
---|
74 | #define PSW_MEMBER(rp) ((rp)->p_reg.psw)
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | #ifdef MINIX_PC
|
---|
78 | #define BP_OFF ((long)&((struct proc *)0)->p_reg.fp)
|
---|
79 | #define PC_MEMBER(rp) ((rp)->p_reg.pc)
|
---|
80 | #define PC_OFF ((long)&((struct proc *)0)->p_reg.pc)
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | #define ADDRSIZE _WORD_SIZE
|
---|
84 | #define BITSIZE(size) (8 * (size))
|
---|
85 | #define INTSIZE (sizeof(int)) /* not quite right for cross-debugger */
|
---|
86 | #define LONGSIZE (sizeof(long))
|
---|
87 | #define UCHAR(x) ((x) & 0xFF)
|
---|
88 | #define NOSEG (-1) /* no segment */
|
---|
89 |
|
---|
90 | /* use hardware codes for segments for simplest decoding */
|
---|
91 | #define CSEG 0x2E /* 8088 through 80386 */
|
---|
92 | #define DSEG 0x3E
|
---|
93 |
|
---|
94 | #if (CHIP == INTEL )
|
---|
95 | #ifdef __i86
|
---|
96 | #define N_REG16 2
|
---|
97 | #endif
|
---|
98 | #ifdef __i386
|
---|
99 | #define N_REG16 4 /* 16 bit registers at start of stackframe */
|
---|
100 | #endif
|
---|
101 | #ifndef N_REG16
|
---|
102 | #error "N_REG16 not defined"
|
---|
103 | #endif
|
---|
104 | #endif
|
---|
105 |
|
---|
106 | #if (CHIP == INTEL )
|
---|
107 | #define ADDA(l) ((u16_t) (l) == 0xC481)
|
---|
108 |
|
---|
109 | #ifdef __i386
|
---|
110 | #define ADDA_CNT(l) ((i32_t) (l))
|
---|
111 | #else
|
---|
112 | #define ADDA_CNT(l) ((i16_t) (l))
|
---|
113 | #endif
|
---|
114 |
|
---|
115 | #define ADDQ(l) ((u16_t) (l) == 0xC483)
|
---|
116 | #define ADDQ_CNT(l) (((((l) >> 16) + 128) & 0x000000FF) - 128)
|
---|
117 | #define BREAK(l) (0x000000CC | ((l) & 0xFFFFFF00))
|
---|
118 | #define BREAKPOINT_ADVANCE 1
|
---|
119 | #define INCSP2(l) ((u16_t) (l) == 0x4444)
|
---|
120 | #define POPBX2(l) ((u16_t) (l) == 0x5B5B)
|
---|
121 | #define POPBX(l) ( (l & 0xFF) == 0x5B)
|
---|
122 |
|
---|
123 | /* Added for ANSI CC */
|
---|
124 | #define POPCX2(l) ((u16_t) (l) == 0x5959)
|
---|
125 | #define POPCX(l) ( (l & 0xFF) == 0x59)
|
---|
126 |
|
---|
127 | #endif
|
---|
128 |
|
---|
129 | #ifdef __mc68000__
|
---|
130 | #define ADDA(l) ((int)((l) >> 16) == 0xDFFC)
|
---|
131 | #define ADDA_CNT(l) (l)
|
---|
132 | #define ADDQ(l) (((l >> 16) & 0xF13F) == 0x500F)
|
---|
133 | #define ADDQ_CNT(l) (((((l) >> 25) - 1) & 7) + 1)
|
---|
134 | #define BREAK(l) (0xA0000000 | ((l) & 0xFFFF))
|
---|
135 | #define BREAKPOINT_ADVANCE 0
|
---|
136 | #define BYTES_SWAPPED /* this assumes WORDS_SWAPPED too */
|
---|
137 | #define LEA(l) (((l) >> 16) == 0x4FEF)
|
---|
138 | #define LEA_DISP(l) ((long)( l & 0xFFFF))
|
---|
139 | #endif
|
---|
140 |
|
---|
141 | #define MASK(size) ((size) >= LONGSIZE ? -1L : (1L << BITSIZE(size)) - 1)
|
---|
142 |
|
---|
143 | #ifdef BYTES_SWAPPED
|
---|
144 | #define SHIFT(size) BITSIZE(LONGSIZE - (size))
|
---|
145 | #else
|
---|
146 | #define SHIFT(size) (0)
|
---|
147 | #endif
|
---|
148 |
|
---|
149 | #ifdef _MAIN_MDB
|
---|
150 | #undef EXTERN
|
---|
151 | #define EXTERN
|
---|
152 | #endif
|
---|
153 |
|
---|
154 | extern long lbuf[]; /* buffer for proc */
|
---|
155 |
|
---|
156 | EXTERN long st_addr; /* starting address of text */
|
---|
157 | EXTERN long et_addr; /* ending address of text */
|
---|
158 | EXTERN long sd_addr; /* starting address of data */
|
---|
159 | EXTERN long ed_addr; /* ending address of data */
|
---|
160 | EXTERN long end_addr; /* ending address of text/data */
|
---|
161 | EXTERN long sk_addr; /* starting address of stack */
|
---|
162 | EXTERN long sk_size; /* size of stack */
|
---|
163 | EXTERN int curpid; /* current pid of process/core */
|
---|
164 | EXTERN int corepid; /* pid of core file */
|
---|
165 | EXTERN int coreonly; /* core file only */
|
---|
166 | EXTERN int fileonly; /* file only */
|
---|
167 | EXTERN int cursig; /* current signal */
|
---|
168 | EXTERN int seg; /* segment */
|
---|
169 | EXTERN int is_separate; /* separate I & D */
|
---|
170 | EXTERN int paging; /* paging flag */
|
---|
171 | #ifdef DEBUG
|
---|
172 | EXTERN int debug; /* debug flag */
|
---|
173 | #endif
|
---|
174 | #if SYSCALLS_SUPPORT
|
---|
175 | EXTERN int syscalls; /* trace syscalls */
|
---|
176 | #endif
|
---|
177 |
|
---|
178 | #ifdef _MAIN_MDB
|
---|
179 | #undef EXTERN
|
---|
180 | #define EXTERN extern
|
---|
181 | #endif
|
---|
182 |
|
---|