3bf57d21 |
1 | /* Parameters for execution on a Gould PN, for GDB, the GNU debugger. |
4187119d |
2 | Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. |
3bf57d21 |
3 | |
4187119d |
4 | This file is part of GDB. |
3bf57d21 |
5 | |
4187119d |
6 | GDB is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 1, or (at your option) |
9 | any later version. |
3bf57d21 |
10 | |
4187119d |
11 | GDB is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU General Public License |
17 | along with GDB; see the file COPYING. If not, write to |
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
19 | |
20 | /* Define the bit, byte, and word ordering of the machine. */ |
21 | #define BITS_BIG_ENDIAN |
22 | #define BYTES_BIG_ENDIAN |
23 | #define WORDS_BIG_ENDIAN |
3bf57d21 |
24 | |
e91b87a3 |
25 | /* This code appears in libraries on Gould machines. Ignore it. */ |
26 | #define IGNORE_SYMBOL(type) (type == N_ENTRY) |
3bf57d21 |
27 | |
4187119d |
28 | /* We don't want the extra gnu symbols on the machine; |
29 | they will interfere with the shared segment symbols. */ |
30 | #define NO_GNU_STABS |
31 | |
3bf57d21 |
32 | /* Macro for text-offset and data info (in PN a.out format). */ |
33 | #define TEXTINFO \ |
34 | text_offset = N_TXTOFF (exec_coffhdr); \ |
35 | exec_data_offset = N_TXTOFF (exec_coffhdr) \ |
36 | + exec_aouthdr.a_text |
37 | |
38 | /* Macro for number of symbol table entries */ |
39 | #define END_OF_TEXT_DEFAULT \ |
40 | (0xffffff) |
41 | |
42 | /* Macro for number of symbol table entries */ |
43 | #define NUMBER_OF_SYMBOLS \ |
44 | (coffhdr.f_nsyms) |
45 | |
46 | /* Macro for file-offset of symbol table (in usual a.out format). */ |
47 | #define SYMBOL_TABLE_OFFSET \ |
48 | N_SYMOFF (coffhdr) |
49 | |
50 | /* Macro for file-offset of string table (in usual a.out format). */ |
51 | #define STRING_TABLE_OFFSET \ |
52 | (N_STROFF (coffhdr) + sizeof(int)) |
53 | |
54 | /* Macro to store the length of the string table data in INTO. */ |
55 | #define READ_STRING_TABLE_SIZE(INTO) \ |
56 | { INTO = hdr.a_stsize; } |
57 | |
58 | /* Macro to declare variables to hold the file's header data. */ |
59 | #define DECLARE_FILE_HEADERS struct old_exec hdr; \ |
60 | FILHDR coffhdr |
61 | |
62 | /* Macro to read the header data from descriptor DESC and validate it. |
63 | NAME is the file name, for error messages. */ |
64 | #define READ_FILE_HEADERS(DESC, NAME) \ |
65 | { val = myread (DESC, &coffhdr, sizeof coffhdr); \ |
66 | if (val < 0) \ |
67 | perror_with_name (NAME); \ |
68 | val = myread (DESC, &hdr, sizeof hdr); \ |
69 | if (val < 0) \ |
70 | perror_with_name (NAME); \ |
71 | if (coffhdr.f_magic != GNP1MAGIC) \ |
72 | error ("File \"%s\" not in coff executable format.", NAME); \ |
73 | if (N_BADMAG (hdr)) \ |
74 | error ("File \"%s\" not in executable format.", NAME); } |
75 | |
76 | /* Define COFF and other symbolic names needed on NP1 */ |
77 | #define NS32GMAGIC GDPMAGIC |
78 | #define NS32SMAGIC PN_MAGIC |
4187119d |
79 | #ifndef HAVE_VPRINTF |
3bf57d21 |
80 | #define vprintf printf |
4187119d |
81 | #endif /* not HAVE_VPRINTF */ |
3bf57d21 |
82 | |
83 | /* Get rid of any system-imposed stack limit if possible. */ |
84 | #define SET_STACK_LIMIT_HUGE |
85 | |
86 | /* Define this if the C compiler puts an underscore at the front |
87 | of external names before giving them to the linker. */ |
88 | #define NAMES_HAVE_UNDERSCORE |
89 | |
90 | /* Debugger information will be in DBX format. */ |
91 | #define READ_DBX_FORMAT |
92 | |
93 | /* Offset from address of function to start of its code. |
94 | Zero on most machines. */ |
95 | #define FUNCTION_START_OFFSET 4 |
96 | |
97 | /* Advance PC across any function entry prologue instructions |
98 | to reach some "real" code. One PN we can have one or two startup |
99 | sequences depending on the size of the local stack: |
100 | |
101 | Either: |
102 | "suabr b2, #" |
103 | of |
104 | "lil r4, #", "suabr b2, #(r4)" |
105 | |
106 | "lwbr b6, #", "stw r1, 8(b2)" |
107 | Optional "stwbr b3, c(b2)" |
108 | Optional "trr r2,r7" (Gould first argument register passing) |
109 | or |
110 | Optional "stw r2,8(b3)" (Gould first argument register passing) |
111 | */ |
112 | #define SKIP_PROLOGUE(pc) { \ |
113 | register int op = read_memory_integer ((pc), 4); \ |
114 | if ((op & 0xffff0000) == 0x580B0000) { \ |
115 | pc += 4; \ |
116 | op = read_memory_integer ((pc), 4); \ |
117 | if ((op & 0xffff0000) == 0x59400000) { \ |
118 | pc += 4; \ |
119 | op = read_memory_integer ((pc), 4); \ |
120 | if ((op & 0xffff0000) == 0x5F000000) { \ |
121 | pc += 4; \ |
122 | op = read_memory_integer ((pc), 4); \ |
123 | if (op == 0xD4820008) { \ |
124 | pc += 4; \ |
125 | op = read_memory_integer ((pc), 4); \ |
126 | if (op == 0x5582000C) { \ |
127 | pc += 4; \ |
128 | op = read_memory_integer ((pc), 2); \ |
129 | if (op == 0x2fa0) { \ |
130 | pc += 2; \ |
131 | } else { \ |
132 | op = read_memory_integer ((pc), 4); \ |
133 | if (op == 0xd5030008) { \ |
134 | pc += 4; \ |
135 | } \ |
136 | } \ |
137 | } else { \ |
138 | op = read_memory_integer ((pc), 2); \ |
139 | if (op == 0x2fa0) { \ |
140 | pc += 2; \ |
141 | } \ |
142 | } \ |
143 | } \ |
144 | } \ |
145 | } \ |
146 | } \ |
147 | if ((op & 0xffff0000) == 0x59000000) { \ |
148 | pc += 4; \ |
149 | op = read_memory_integer ((pc), 4); \ |
150 | if ((op & 0xffff0000) == 0x5F000000) { \ |
151 | pc += 4; \ |
152 | op = read_memory_integer ((pc), 4); \ |
153 | if (op == 0xD4820008) { \ |
154 | pc += 4; \ |
155 | op = read_memory_integer ((pc), 4); \ |
156 | if (op == 0x5582000C) { \ |
157 | pc += 4; \ |
158 | op = read_memory_integer ((pc), 2); \ |
159 | if (op == 0x2fa0) { \ |
160 | pc += 2; \ |
161 | } else { \ |
162 | op = read_memory_integer ((pc), 4); \ |
163 | if (op == 0xd5030008) { \ |
164 | pc += 4; \ |
165 | } \ |
166 | } \ |
167 | } else { \ |
168 | op = read_memory_integer ((pc), 2); \ |
169 | if (op == 0x2fa0) { \ |
170 | pc += 2; \ |
171 | } \ |
172 | } \ |
173 | } \ |
174 | } \ |
175 | } \ |
176 | } |
177 | |
178 | /* Immediately after a function call, return the saved pc. |
179 | Can't go through the frames for this because on some machines |
180 | the new frame is not set up until the new function executes |
181 | some instructions. True on PN! Return address is in R1. |
182 | Note: true return location is 4 bytes past R1! */ |
183 | #define SAVED_PC_AFTER_CALL(frame) \ |
184 | (read_register(R1_REGNUM) + 4) |
185 | |
186 | /* Address of U in kernel space */ |
187 | #define KERNEL_U_ADDR 0x3fc000 |
188 | |
189 | /* Address of end of stack space. */ |
190 | #define STACK_END_ADDR 0x480000 |
191 | |
192 | /* Stack grows downward. */ |
193 | #define INNER_THAN < |
194 | |
195 | /* Sequence of bytes for breakpoint instruction. */ |
196 | #define BREAKPOINT {0x28, 0x09} |
197 | |
198 | /* Amount PC must be decremented by after a breakpoint. |
199 | This is often the number of bytes in BREAKPOINT |
200 | but not always. */ |
201 | #define DECR_PC_AFTER_BREAK 2 |
202 | |
203 | /* Nonzero if instruction at PC is a return instruction. "bu 4(r1)" */ |
204 | #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 4) == 0xEC100004) |
205 | |
206 | /* Return 1 if P points to an invalid floating point value. */ |
207 | #define INVALID_FLOAT(p, len) ((*(short *)p & 0xff80) == 0x8000) |
208 | |
e91b87a3 |
209 | /* Largest integer type */ |
210 | #define LONGEST long |
211 | |
212 | /* Name of the builtin type for the LONGEST type above. */ |
213 | #define BUILTIN_TYPE_LONGEST builtin_type_long |
214 | |
3bf57d21 |
215 | /* Say how long (ordinary) registers are. */ |
216 | #define REGISTER_TYPE long |
217 | |
218 | /* Number of machine registers */ |
219 | #define NUM_REGS 19 |
220 | #define NUM_GEN_REGS 16 |
221 | #define NUM_CPU_REGS 3 |
222 | |
223 | /* Initializer for an array of names of registers. |
224 | There should be NUM_REGS strings in this initializer. */ |
225 | #define REGISTER_NAMES { \ |
226 | "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ |
227 | "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", \ |
228 | "sp", "ps", "pc", \ |
229 | } |
230 | |
231 | /* Register numbers of various important registers. |
232 | Note that some of these values are "real" register numbers, |
233 | and correspond to the general registers of the machine, |
234 | and some are "phony" register numbers which are too large |
235 | to be actual register numbers as far as the user is concerned |
236 | but do serve to get the desired values when passed to read_register. */ |
237 | #define R1_REGNUM 1 /* Gr1 => return address of caller */ |
238 | #define R4_REGNUM 4 /* Gr4 => register save area */ |
239 | #define R5_REGNUM 5 /* Gr5 => register save area */ |
240 | #define R6_REGNUM 6 /* Gr6 => register save area */ |
241 | #define R7_REGNUM 7 /* Gr7 => register save area */ |
242 | #define B1_REGNUM 9 /* Br1 => start of this code routine */ |
243 | #define FP_REGNUM 10 /* Br2 == (sp) */ |
244 | #define AP_REGNUM 11 /* Br3 == (ap) */ |
245 | #define SP_REGNUM 16 /* A copy of Br2 saved in trap */ |
246 | #define PS_REGNUM 17 /* Contains processor status */ |
247 | #define PC_REGNUM 18 /* Contains program counter */ |
248 | |
249 | /* This is a piece of magic that is given a register number REGNO |
250 | and as BLOCKEND the address in the system of the end of the user structure |
251 | and stores in ADDR the address in the kernel or core dump |
252 | of that register. */ |
253 | #define REGISTER_U_ADDR(addr, blockend, regno) { \ |
254 | addr = blockend + regno * 4; \ |
255 | if (regno == PC_REGNUM) addr = blockend - 8 * 4; \ |
256 | if (regno == PS_REGNUM) addr = blockend - 7 * 4; \ |
257 | if (regno == SP_REGNUM) addr = blockend - 6 * 4; \ |
258 | } |
259 | |
260 | /* Total amount of space needed to store our copies of the machine's |
261 | register state, the array `registers'. */ |
262 | #define REGISTER_BYTES (NUM_GEN_REGS*4 + NUM_CPU_REGS*4) |
263 | |
264 | /* Index within `registers' of the first byte of the space for |
265 | register N. */ |
266 | #define REGISTER_BYTE(N) ((N) * 4) |
267 | |
268 | /* Number of bytes of storage in the actual machine representation |
269 | for register N. On the PN, all normal regs are 4 bytes. */ |
270 | #define REGISTER_RAW_SIZE(N) (4) |
271 | |
272 | /* Number of bytes of storage in the program's representation |
273 | for register N. On the PN, all regs are 4 bytes. */ |
274 | #define REGISTER_VIRTUAL_SIZE(N) (4) |
275 | |
276 | /* Largest value REGISTER_RAW_SIZE can have. */ |
277 | #define MAX_REGISTER_RAW_SIZE (4) |
278 | |
279 | /* Largest value REGISTER_VIRTUAL_SIZE can have. */ |
280 | #define MAX_REGISTER_VIRTUAL_SIZE (4) |
281 | |
282 | /* Nonzero if register N requires conversion |
283 | from raw format to virtual format. */ |
284 | #define REGISTER_CONVERTIBLE(N) (0) |
285 | |
286 | /* Convert data from raw format for register REGNUM |
287 | to virtual format for register REGNUM. */ |
288 | #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \ |
289 | bcopy ((FROM), (TO), REGISTER_RAW_SIZE(REGNUM)); |
290 | |
291 | /* Convert data from virtual format for register REGNUM |
292 | to raw format for register REGNUM. */ |
293 | #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \ |
294 | bcopy ((FROM), (TO), REGISTER_VIRTUAL_SIZE(REGNUM)); |
295 | |
296 | /* Return the GDB type object for the "standard" data type |
297 | of data in register N. */ |
298 | #define REGISTER_VIRTUAL_TYPE(N) (builtin_type_int) |
299 | |
e91b87a3 |
300 | /* Store the address of the place in which to copy the structure the |
301 | subroutine will return. This is called from call_function. |
302 | |
303 | On this machine this is a no-op, because gcc isn't used on it |
304 | yet. So this calling convention is not used. */ |
305 | |
306 | #define STORE_STRUCT_RETURN(ADDR, SP) |
307 | |
3bf57d21 |
308 | /* Extract from an arrary REGBUF containing the (raw) register state |
309 | a function return value of type TYPE, and copy that, in virtual format, |
310 | into VALBUF. */ |
311 | |
312 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ |
313 | bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE)) |
314 | |
315 | /* Write into appropriate registers a function return value |
316 | of type TYPE, given in virtual format. */ |
317 | |
318 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ |
319 | write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) |
320 | |
321 | /* Extract from an array REGBUF containing the (raw) register state |
322 | the address in which a function should return its structure value, |
323 | as a CORE_ADDR (or an expression that can be used as one). */ |
324 | |
325 | #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) |
326 | |
327 | \f |
328 | /* Describe the pointer in each stack frame to the previous stack frame |
329 | (its caller). */ |
330 | |
331 | /* FRAME_CHAIN takes a frame's nominal address |
332 | and produces the frame's chain-pointer. |
333 | |
334 | FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address |
335 | and produces the nominal address of the caller frame. |
336 | |
337 | However, if FRAME_CHAIN_VALID returns zero, |
338 | it means the given frame is the outermost one and has no caller. |
339 | In that case, FRAME_CHAIN_COMBINE is not used. */ |
340 | |
341 | /* In the case of the NPL, the frame's norminal address is Br2 and the |
342 | previous routines frame is up the stack X bytes, where X is the |
343 | value stored in the code function header xA(Br1). */ |
344 | #define FRAME_CHAIN(thisframe) (findframe(thisframe)) |
345 | |
346 | #define FRAME_CHAIN_VALID(chain, thisframe) \ |
e91b87a3 |
347 | (chain != 0 && chain != (thisframe)->frame) |
3bf57d21 |
348 | |
349 | #define FRAME_CHAIN_COMBINE(chain, thisframe) \ |
350 | (chain) |
351 | |
352 | /* Define other aspects of the stack frame on NPL. */ |
e91b87a3 |
353 | #define FRAME_SAVED_PC(frame) \ |
354 | (read_memory_integer ((frame)->frame + 8, 4)) |
3bf57d21 |
355 | |
356 | #define FRAME_ARGS_ADDRESS(fi) \ |
e91b87a3 |
357 | ((fi)->next_frame ? \ |
358 | read_memory_integer ((fi)->frame + 12, 4) : \ |
3bf57d21 |
359 | read_register (AP_REGNUM)) |
360 | |
e91b87a3 |
361 | #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame + 80) |
3bf57d21 |
362 | |
363 | /* Set VAL to the number of args passed to frame described by FI. |
364 | Can set VAL to -1, meaning no way to tell. */ |
365 | |
366 | /* We can check the stab info to see how |
367 | many arg we have. No info in stack will tell us */ |
368 | #define FRAME_NUM_ARGS(val,fi) (val = findarg(fi)) |
369 | |
370 | /* Return number of bytes at start of arglist that are not really args. */ |
371 | #define FRAME_ARGS_SKIP 8 |
372 | |
373 | /* Put here the code to store, into a struct frame_saved_regs, |
374 | the addresses of the saved registers of frame described by FRAME_INFO. |
375 | This includes special registers such as pc and fp saved in special |
376 | ways in the stack frame. sp is even more special: |
377 | the address we return for it IS the sp for the next frame. */ |
378 | |
379 | #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ |
380 | { \ |
381 | bzero (&frame_saved_regs, sizeof frame_saved_regs); \ |
e91b87a3 |
382 | (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 8; \ |
383 | (frame_saved_regs).regs[R4_REGNUM] = (frame_info)->frame + 0x30; \ |
384 | (frame_saved_regs).regs[R5_REGNUM] = (frame_info)->frame + 0x34; \ |
385 | (frame_saved_regs).regs[R6_REGNUM] = (frame_info)->frame + 0x38; \ |
386 | (frame_saved_regs).regs[R7_REGNUM] = (frame_info)->frame + 0x3C; \ |
3bf57d21 |
387 | } |
388 | \f |
389 | /* Things needed for making the inferior call functions. */ |
390 | |
391 | /* Push an empty stack frame, to record the current PC, etc. */ |
392 | |
393 | #define PUSH_DUMMY_FRAME \ |
394 | { register CORE_ADDR sp = read_register (SP_REGNUM); \ |
395 | register int regnum; \ |
396 | sp = push_word (sp, read_register (PC_REGNUM)); \ |
397 | sp = push_word (sp, read_register (FP_REGNUM)); \ |
398 | write_register (FP_REGNUM, sp); \ |
399 | for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \ |
400 | sp = push_word (sp, read_register (regnum)); \ |
401 | sp = push_word (sp, read_register (PS_REGNUM)); \ |
402 | write_register (SP_REGNUM, sp); } |
403 | |
404 | /* Discard from the stack the innermost frame, |
405 | restoring all saved registers. */ |
406 | |
407 | #define POP_FRAME \ |
e91b87a3 |
408 | { register FRAME frame = get_current_frame (); \ |
409 | register CORE_ADDR fp; \ |
3bf57d21 |
410 | register int regnum; \ |
411 | struct frame_saved_regs fsr; \ |
e91b87a3 |
412 | struct frame_info *fi; \ |
413 | fi = get_frame_info (frame); \ |
414 | fp = fi->frame; \ |
415 | get_frame_saved_regs (fi, &fsr); \ |
3bf57d21 |
416 | for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \ |
417 | if (fsr.regs[regnum]) \ |
418 | write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \ |
419 | if (fsr.regs[PS_REGNUM]) \ |
420 | write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4)); \ |
421 | write_register (FP_REGNUM, read_memory_integer (fp, 4)); \ |
422 | write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \ |
423 | write_register (SP_REGNUM, fp + 8); \ |
e91b87a3 |
424 | flush_cached_frames (); \ |
425 | set_current_frame ( create_new_frame (read_register (FP_REGNUM),\ |
426 | read_pc ())); } |
3bf57d21 |
427 | |
428 | /* This sequence of words is the instructions: |
429 | halt |
430 | halt |
431 | halt |
432 | halt |
433 | suabr b2, #<stacksize> |
434 | lwbr b6, #con |
435 | stw r1, 8(b2) - save caller address, do we care? |
436 | lw r2, 60(b2) - arg1 |
437 | labr b3, 50(b2) |
438 | std r4, 30(b2) - save r4-r7 |
439 | std r6, 38(b2) |
440 | lwbr b1, #<func> - load function call address |
441 | brlnk r1, 8(b1) - call function |
442 | halt |
443 | halt |
444 | ld r4, 30(b2) - restore r4-r7 |
445 | ld r6, 38(b2) |
446 | |
447 | Setup our stack frame, load argumemts, call and then restore registers. |
448 | */ |
449 | |
450 | #define CALL_DUMMY {0xf227e0ff, 0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, 0x4e4f4e71} |
451 | |
452 | #define CALL_DUMMY_LENGTH 28 |
453 | |
454 | #define CALL_DUMMY_START_OFFSET 12 |
455 | |
456 | /* Insert the specified number of args and function address |
457 | into a call sequence of the above form stored at DUMMYNAME. */ |
458 | |
e91b87a3 |
459 | #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, type) \ |
3bf57d21 |
460 | { *(int *)((char *) dummyname + 20) = nargs * 4; \ |
461 | *(int *)((char *) dummyname + 14) = fun; } |
462 | \f |
463 | /* |
464 | * No KDB support, Yet! */ |
465 | /* Interface definitions for kernel debugger KDB. */ |
466 | |
467 | /* Map machine fault codes into signal numbers. |
468 | First subtract 0, divide by 4, then index in a table. |
469 | Faults for which the entry in this table is 0 |
470 | are not handled by KDB; the program's own trap handler |
471 | gets to handle then. */ |
472 | |
473 | #define FAULT_CODE_ORIGIN 0 |
474 | #define FAULT_CODE_UNITS 4 |
475 | #define FAULT_TABLE \ |
476 | { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \ |
477 | 0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \ |
478 | 0, 0, 0, 0, 0, 0, 0, 0, \ |
479 | SIGILL } |
480 | |
481 | /* Start running with a stack stretching from BEG to END. |
482 | BEG and END should be symbols meaningful to the assembler. |
483 | This is used only for kdb. */ |
484 | |
485 | #define INIT_STACK(beg, end) \ |
486 | { asm (".globl end"); \ |
487 | asm ("movel $ end, sp"); \ |
488 | asm ("clrl fp"); } |
489 | |
490 | /* Push the frame pointer register on the stack. */ |
491 | #define PUSH_FRAME_PTR \ |
492 | asm ("movel fp, -(sp)"); |
493 | |
494 | /* Copy the top-of-stack to the frame pointer register. */ |
495 | #define POP_FRAME_PTR \ |
496 | asm ("movl (sp), fp"); |
497 | |
498 | /* After KDB is entered by a fault, push all registers |
499 | that GDB thinks about (all NUM_REGS of them), |
500 | so that they appear in order of ascending GDB register number. |
501 | The fault code will be on the stack beyond the last register. */ |
502 | |
503 | #define PUSH_REGISTERS \ |
504 | { asm ("clrw -(sp)"); \ |
505 | asm ("pea 10(sp)"); \ |
506 | asm ("movem $ 0xfffe,-(sp)"); } |
507 | |
508 | /* Assuming the registers (including processor status) have been |
509 | pushed on the stack in order of ascending GDB register number, |
510 | restore them and return to the address in the saved PC register. */ |
511 | |
512 | #define POP_REGISTERS \ |
513 | { asm ("subil $8,28(sp)"); \ |
514 | asm ("movem (sp),$ 0xffff"); \ |
515 | asm ("rte"); } |