]>
Commit | Line | Data |
---|---|---|
dd3b648e RP |
1 | /* Parameters for execution on an HP 9000 model 320, for GDB, the GNU debugger. |
2 | Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GDB. | |
5 | ||
99a7de40 | 6 | This program is free software; you can redistribute it and/or modify |
dd3b648e | 7 | it under the terms of the GNU General Public License as published by |
99a7de40 JG |
8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | |
dd3b648e | 10 | |
99a7de40 | 11 | This program is distributed in the hope that it will be useful, |
dd3b648e RP |
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 | |
99a7de40 JG |
17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
dd3b648e RP |
19 | |
20 | /* Sequence of bytes for breakpoint instruction. */ | |
21 | ||
22 | #define BREAKPOINT {0x4e, 0x41} | |
23 | ||
24 | /* Define this if the C compiler puts an underscore at the front | |
25 | of external names before giving them to the linker. */ | |
26 | ||
27 | #define NAMES_HAVE_UNDERSCORE | |
28 | ||
29 | /* Debugger information will be in DBX format. */ | |
30 | ||
31 | #define READ_DBX_FORMAT | |
32 | ||
33 | /* Address of end of stack space. */ | |
34 | ||
35 | #define STACK_END_ADDR 0xFFF00000 | |
36 | \f | |
37 | /* Things needed for making the inferior call functions. */ | |
38 | ||
39 | /* Push an empty stack frame, to record the current PC, etc. */ | |
40 | ||
41 | #define PUSH_DUMMY_FRAME \ | |
42 | { register CORE_ADDR sp = read_register (SP_REGNUM); \ | |
43 | register int regnum; \ | |
44 | char raw_buffer[12]; \ | |
45 | sp = push_word (sp, read_register (PC_REGNUM)); \ | |
46 | sp = push_word (sp, read_register (FP_REGNUM)); \ | |
47 | write_register (FP_REGNUM, sp); \ | |
48 | for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) \ | |
49 | { read_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); \ | |
50 | sp = push_bytes (sp, raw_buffer, 12); } \ | |
51 | for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \ | |
52 | sp = push_word (sp, read_register (regnum)); \ | |
53 | sp = push_word (sp, read_register (PS_REGNUM)); \ | |
54 | write_register (SP_REGNUM, sp); } | |
55 | ||
56 | /* Discard from the stack the innermost frame, | |
57 | restoring all saved registers. */ | |
58 | ||
59 | #define POP_FRAME \ | |
60 | { register FRAME frame = get_current_frame (); \ | |
61 | register CORE_ADDR fp; \ | |
62 | register int regnum; \ | |
63 | struct frame_saved_regs fsr; \ | |
64 | struct frame_info *fi; \ | |
65 | char raw_buffer[12]; \ | |
66 | fi = get_frame_info (frame); \ | |
67 | fp = fi->frame; \ | |
68 | get_frame_saved_regs (fi, &fsr); \ | |
69 | for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--) \ | |
70 | if (fsr.regs[regnum]) \ | |
71 | { read_memory (fsr.regs[regnum], raw_buffer, 12); \ | |
72 | write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12); }\ | |
73 | for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) \ | |
74 | if (fsr.regs[regnum]) \ | |
75 | write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \ | |
76 | if (fsr.regs[PS_REGNUM]) \ | |
77 | write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4)); \ | |
78 | write_register (FP_REGNUM, read_memory_integer (fp, 4)); \ | |
79 | write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \ | |
80 | write_register (SP_REGNUM, fp + 8); \ | |
81 | flush_cached_frames (); \ | |
82 | set_current_frame (create_new_frame (read_register (FP_REGNUM),\ | |
83 | read_pc ()));} | |
84 | ||
85 | /* This sequence of words is the instructions | |
86 | fmovem 0xff,-(sp) | |
87 | moveml 0xfffc,-(sp) | |
88 | clrw -(sp) | |
89 | movew ccr,-(sp) | |
90 | /..* The arguments are pushed at this point by GDB; | |
91 | no code is needed in the dummy for this. | |
92 | The CALL_DUMMY_START_OFFSET gives the position of | |
93 | the following jsr instruction. *../ | |
94 | jsr @#32323232 | |
95 | addl #69696969,sp | |
96 | bpt | |
97 | nop | |
98 | Note this is 28 bytes. | |
99 | We actually start executing at the jsr, since the pushing of the | |
100 | registers is done by PUSH_DUMMY_FRAME. If this were real code, | |
101 | the arguments for the function called by the jsr would be pushed | |
102 | between the moveml and the jsr, and we could allow it to execute through. | |
103 | But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is done, | |
104 | and we cannot allow the moveml to push the registers again lest they be | |
105 | taken for the arguments. */ | |
106 | ||
107 | #define CALL_DUMMY {0xf227e0ff, 0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, 0x4e414e71} | |
108 | ||
109 | #define CALL_DUMMY_LENGTH 28 | |
110 | ||
111 | #define CALL_DUMMY_START_OFFSET 12 | |
112 | ||
113 | /* Insert the specified number of args and function address | |
114 | into a call sequence of the above form stored at DUMMYNAME. */ | |
115 | ||
116 | #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ | |
117 | { *(int *)((char *) dummyname + 20) = nargs * 4; \ | |
118 | *(int *)((char *) dummyname + 14) = fun; } | |
119 | \f | |
120 | #include HAVE_68881 | |
121 | ||
122 | #include "tm-68k.h" |