Commit | Line | Data |
---|---|---|
2222b6d9 KB |
1 | /* |
2 | * Copyright (c) 1988 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * @(#)machdep.h 5.1 (Berkeley) %G% | |
6 | */ | |
7 | ||
8 | /* | |
9 | * hword_t is a 2-byte (`halfword') type, used for (eg) w, l, x commands; | |
10 | * addr_t is address type, must be unsigned; registers pc, fp, sp | |
11 | * (where those exist) are assumed to be of this type, and | |
12 | * addresses in the debuggee are of this type; | |
13 | * expr_t is expression result type, size must be >= size of addr_t and | |
14 | * reg_t; must be unsigned; it is treated as the fullword type | |
15 | * and should therefore be 4 bytes long; | |
16 | * sexpr_t is a signed version of expr_t. | |
17 | * | |
18 | * SHOULD WORK ON ALLOWING (eg) 1 AND 2 BYTE, OR 4 AND 8 BYTE, ETC, WORDS | |
19 | */ | |
20 | typedef u_int addr_t; | |
21 | typedef u_int expr_t; | |
22 | typedef int sexpr_t; | |
23 | typedef u_short hword_t; | |
24 | ||
25 | /* | |
26 | * Since values of type addr_t, hword_t, and expr_t must be printed, | |
27 | * and the varargs mechanism assumes that the programmer has accounted | |
28 | * for any extension from `small' types (char, short) to `regular' types | |
29 | * (int), we define the following macros. Each is supposed to produce | |
30 | * a (possibly sign-extended) expr_t value: | |
31 | * | |
32 | * SH_ARG a signed halfword (%d, %q formats) | |
33 | * UH_ARG an unsigned halfword (o, u, x) | |
34 | * SF_ARG a signed fullword (D, Q) | |
35 | * UF_ARG an unsigned fullword (O, U, X) | |
36 | */ | |
37 | #define SH_ARG (expr_t)(short)va_arg(ap, int) | |
38 | #define UH_ARG (expr_t)(unsigned short)va_arg(ap, int) | |
39 | #define SF_ARG (expr_t)va_arg(ap, int) | |
40 | #define UF_ARG (expr_t)va_arg(ap, int) | |
41 | ||
42 | /* | |
43 | * bpt_t is used to hold original instructions when their breakpoint | |
44 | * replacement(s) is/are set. | |
45 | */ | |
46 | typedef char bpt_t; | |
47 | ||
48 | /* | |
49 | * ADDRESS_WRAP is a predicate that returns true if the two addr_t | |
50 | * arguments are in different spaces. | |
51 | */ | |
52 | #define ADDRESS_WRAP(a, b) (((a) ^ (b)) >> 30) | |
53 | ||
54 | /* | |
55 | * Struct activation is used for tracing through stack frames. | |
56 | * It must hold any information needed to locate an activation record | |
57 | * (variables and parameters) for a function, and must have two fields | |
58 | * of type addr_t called `a_pc' and `a_fp', the `program counter' and | |
59 | * the `frame pointer'. a_pc is used by the expression evaluator to | |
60 | * find symbols; a_fp is returned as the result from an expression of | |
61 | * the form `name.' (a routine name, but no local symbol). | |
62 | * The field a_valid is cleared by a_prev() when there are no more | |
63 | * activation records on the stack. | |
64 | */ | |
65 | struct activation { | |
66 | int a_valid; /* set iff frame is valid */ | |
67 | addr_t a_ap; /* ap */ | |
68 | addr_t a_fp; /* fp */ | |
69 | addr_t a_pc; /* pc */ | |
70 | }; | |
71 | ||
72 | /* | |
73 | * The reglist structure holds information needed to set and examine | |
74 | * registers. It must contain an r_name field; this name must be unique | |
75 | * across the register set, cannot be a single letter or digit, and | |
76 | * cannot be a substring of any other register name. | |
77 | * | |
78 | * On the VAX, we keep an offset into the u. area, either from the | |
79 | * base of the u. area (in the pcb), or, for those registers that | |
80 | * are saved by syscalls, in the save area pointed to by u.u_ar0. | |
81 | * Offsets into the latter region are negative. | |
82 | * | |
83 | * We also keep a pointer into the current pcb for use when debugging | |
84 | * the kernel. | |
85 | */ | |
86 | struct reglist { | |
87 | char *r_name; /* name */ | |
88 | int r_offset; /* offset into pcb, or from u.u_ar0 */ | |
89 | int *r_pcbaddr; /* if kcore, address in current pcb */ | |
90 | }; | |
91 | ||
92 | /* | |
93 | * ispace_reg() is true iff register r points into I-space (usually just PC). | |
94 | */ | |
95 | #ifdef lint | |
96 | #define ispace_reg(r) ((r) == NULL) | |
97 | #else | |
98 | #define ispace_reg(r) 0 /* ispace==dspace on VAX */ | |
99 | #endif | |
100 | ||
101 | /* | |
102 | * getpc() returns as an addr_t the current PC; setpc() sets PC to its | |
103 | * addr_t argument. entrypc() returns the addr_t value of the appropriate | |
104 | * startup PC. | |
105 | */ | |
106 | addr_t getpc(); | |
107 | #define entrypc() ((addr_t)2) | |
108 | ||
109 | /* | |
110 | * INSTACK is true when its argument is a stack address. It is | |
111 | * only used for consistency checking and may be overly permissive. | |
112 | * INKERNEL is true iff its argument is a kernel space address. | |
113 | */ | |
114 | #define INSTACK(a) (((a) & 0xc0000000) == 0x40000000) /* p1 space */ | |
115 | #define INKERNEL(a) (((a) & 0xc0000000) == 0x80000000) /* sys space */ | |
116 | ||
117 | #define KERNTEXTOFF KERNBASE /* start of kernel text */ |