]>
Commit | Line | Data |
---|---|---|
dd3b648e RP |
1 | /* Parameters for execution on a 68000 series machine. |
2 | Copyright (C) 1986, 1987, 1989, 1990 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 | /* Generic 68000 stuff, to be included by other m-*.h files. | |
21 | Define HAVE_68881 if that is the case. */ | |
22 | ||
23 | #if defined (HAVE_68881) | |
24 | #define IEEE_FLOAT 1 | |
25 | #endif | |
26 | ||
27 | /* Define the bit, byte, and word ordering of the machine. */ | |
28 | #define TARGET_BYTE_ORDER BIG_ENDIAN | |
29 | ||
30 | /* Offset from address of function to start of its code. | |
31 | Zero on most machines. */ | |
32 | ||
33 | #define FUNCTION_START_OFFSET 0 | |
34 | ||
35 | /* Advance PC across any function entry prologue instructions | |
36 | to reach some "real" code. */ | |
37 | ||
38 | #define SKIP_PROLOGUE(pc) \ | |
39 | { register int op = read_memory_integer (pc, 2); \ | |
40 | if (op == 0047126) \ | |
41 | pc += 4; /* Skip link #word */ \ | |
42 | else if (op == 0044016) \ | |
43 | pc += 6; /* Skip link #long */ \ | |
44 | /* Not sure why branches are here. */ \ | |
45 | /* From m-isi.h, m-altos.h */ \ | |
46 | else if (op == 0060000) \ | |
47 | pc += 4; /* Skip bra #word */ \ | |
48 | else if (op == 00600377) \ | |
49 | pc += 6; /* skip bra #long */ \ | |
50 | else if ((op & 0177400) == 0060000) \ | |
51 | pc += 2; /* skip bra #char */ \ | |
52 | } | |
53 | ||
54 | /* Immediately after a function call, return the saved pc. | |
55 | Can't always go through the frames for this because on some machines | |
56 | the new frame is not set up until the new function executes | |
57 | some instructions. */ | |
58 | ||
59 | #define SAVED_PC_AFTER_CALL(frame) \ | |
60 | read_memory_integer (read_register (SP_REGNUM), 4) | |
61 | ||
62 | /* Stack grows downward. */ | |
63 | ||
64 | #define INNER_THAN < | |
65 | ||
66 | /* Sequence of bytes for breakpoint instruction. | |
67 | This is a TRAP instruction. The last 4 bits (0xf below) is the | |
68 | vector. Systems which don't use 0xf should define BREAKPOINT | |
69 | themselves before including this file. */ | |
70 | ||
71 | #if !defined (BREAKPOINT) | |
72 | #define BREAKPOINT {0x4e, 0x4f} | |
73 | #endif | |
74 | ||
75 | /* If your kernel resets the pc after the trap happens you may need to | |
76 | define this in m-68k.h. */ | |
77 | ||
78 | #if !defined (DECR_PC_AFTER_BREAK) | |
79 | #define DECR_PC_AFTER_BREAK 2 | |
80 | #endif | |
81 | ||
82 | /* Nonzero if instruction at PC is a return instruction. */ | |
83 | /* Allow any of the return instructions, including a trapv and a return | |
84 | from interupt. */ | |
85 | ||
86 | #define ABOUT_TO_RETURN(pc) ((read_memory_integer (pc, 2) & ~0x3) == 0x4e74) | |
87 | ||
88 | /* Return 1 if P points to an invalid floating point value. */ | |
89 | ||
90 | #define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */ | |
91 | ||
92 | /* Say how long registers are. */ | |
93 | ||
94 | #define REGISTER_TYPE long | |
95 | ||
96 | #if defined (HAVE_68881) | |
39d2bcca | 97 | # if defined (GDB_TARGET_IS_SUN3) |
dd3b648e RP |
98 | /* Sun3 status includes fpflags, which shows whether the FPU has been used |
99 | by the process, and whether the FPU was done with an instruction or | |
100 | was interrupted in the middle of a long instruction. See | |
101 | <machine/reg.h>. */ | |
102 | /* a&d, pc,sr, fp, fpstat, fpflags */ | |
103 | # define NUM_REGS 31 | |
104 | # define REGISTER_BYTES (16*4 + 8 + 8*12 + 3*4 + 4) | |
105 | # else /* Not sun3. */ | |
106 | # define NUM_REGS 29 | |
107 | # define REGISTER_BYTES (16*4 + 8 + 8*12 + 3*4) | |
108 | # endif /* Not sun3. */ | |
109 | #else /* No 68881. */ | |
110 | # define NUM_REGS 18 | |
111 | # define REGISTER_BYTES (16*4 + 8) | |
112 | #endif /* No 68881. */ | |
113 | ||
114 | /* Index within `registers' of the first byte of the space for | |
115 | register N. */ | |
116 | ||
117 | #if defined (HAVE_68881) | |
118 | #define REGISTER_BYTE(N) \ | |
119 | ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 168 \ | |
120 | : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 12) + 72 \ | |
121 | : (N) * 4) | |
122 | ||
123 | /* Number of bytes of storage in the actual machine representation | |
124 | for register N. On the 68000, all regs are 4 bytes | |
125 | except the floating point regs which are 12 bytes. */ | |
126 | /* Note that the unsigned cast here forces the result of the | |
127 | subtraction to very high positive values if N < FP0_REGNUM */ | |
128 | ||
129 | #define REGISTER_RAW_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 12 : 4) | |
130 | ||
131 | /* Number of bytes of storage in the program's representation | |
132 | for register N. On the 68000, all regs are 4 bytes | |
133 | except the floating point regs which are 8-byte doubles. */ | |
134 | ||
135 | #define REGISTER_VIRTUAL_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 8 : 4) | |
136 | ||
137 | /* Largest value REGISTER_RAW_SIZE can have. */ | |
138 | ||
139 | #define MAX_REGISTER_RAW_SIZE 12 | |
140 | ||
141 | /* Largest value REGISTER_VIRTUAL_SIZE can have. */ | |
142 | ||
143 | #define MAX_REGISTER_VIRTUAL_SIZE 8 | |
144 | ||
145 | /* Nonzero if register N requires conversion | |
146 | from raw format to virtual format. */ | |
147 | ||
148 | #define REGISTER_CONVERTIBLE(N) (((unsigned)(N) - FP0_REGNUM) < 8) | |
149 | ||
de6060de JK |
150 | /* Put the declaration out here because if it's in the macros, PCC |
151 | will complain. */ | |
9fa28378 | 152 | extern struct ext_format ext_format_68881; |
de6060de | 153 | |
dd3b648e RP |
154 | /* Convert data from raw format for register REGNUM |
155 | to virtual format for register REGNUM. */ | |
156 | ||
157 | #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \ | |
158 | { \ | |
dd3b648e | 159 | if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \ |
9fa28378 | 160 | ieee_extended_to_double (&ext_format_68881, (FROM), (double *)(TO)); \ |
dd3b648e RP |
161 | else \ |
162 | bcopy ((FROM), (TO), 4); \ | |
163 | } | |
164 | ||
165 | /* Convert data from virtual format for register REGNUM | |
166 | to raw format for register REGNUM. */ | |
167 | ||
168 | #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \ | |
169 | { \ | |
dd3b648e | 170 | if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \ |
9fa28378 | 171 | double_to_ieee_extended (&ext_format_68881, (double *)(FROM), (TO)); \ |
dd3b648e RP |
172 | else \ |
173 | bcopy ((FROM), (TO), 4); \ | |
174 | } | |
175 | ||
176 | /* Return the GDB type object for the "standard" data type | |
177 | of data in register N. */ | |
178 | /* Note, for registers which contain addresses return | |
179 | pointer to void, not pointer to char, because we don't | |
180 | want to attempt to print the string after printing the address. */ | |
181 | #define REGISTER_VIRTUAL_TYPE(N) \ | |
182 | (((unsigned)(N) - FP0_REGNUM) < 8 ? builtin_type_double : \ | |
183 | (N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM ? \ | |
184 | lookup_pointer_type (builtin_type_void) : builtin_type_int) | |
185 | ||
186 | #else /* no 68881. */ | |
187 | /* Index within `registers' of the first byte of the space for | |
188 | register N. */ | |
189 | ||
190 | #define REGISTER_BYTE(N) ((N) * 4) | |
191 | ||
192 | /* Number of bytes of storage in the actual machine representation | |
193 | for register N. On the 68000, all regs are 4 bytes. */ | |
194 | ||
195 | #define REGISTER_RAW_SIZE(N) 4 | |
196 | ||
197 | /* Number of bytes of storage in the program's representation | |
198 | for register N. On the 68000, all regs are 4 bytes. */ | |
199 | ||
200 | #define REGISTER_VIRTUAL_SIZE(N) 4 | |
201 | ||
202 | /* Largest value REGISTER_RAW_SIZE can have. */ | |
203 | ||
204 | #define MAX_REGISTER_RAW_SIZE 4 | |
205 | ||
206 | /* Largest value REGISTER_VIRTUAL_SIZE can have. */ | |
207 | ||
208 | #define MAX_REGISTER_VIRTUAL_SIZE 4 | |
209 | ||
210 | /* Nonzero if register N requires conversion | |
211 | from raw format to virtual format. */ | |
212 | ||
213 | #define REGISTER_CONVERTIBLE(N) 0 | |
214 | ||
215 | /* Convert data from raw format for register REGNUM | |
216 | to virtual format for register REGNUM. */ | |
217 | ||
218 | #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) bcopy ((FROM), (TO), 4); | |
219 | ||
220 | /* Convert data from virtual format for register REGNUM | |
221 | to raw format for register REGNUM. */ | |
222 | ||
223 | #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) bcopy ((FROM), (TO), 4); | |
224 | ||
225 | /* Return the GDB type object for the "standard" data type | |
226 | of data in register N. */ | |
227 | ||
228 | #define REGISTER_VIRTUAL_TYPE(N) builtin_type_int | |
229 | ||
230 | #endif /* No 68881. */ | |
231 | ||
232 | /* Initializer for an array of names of registers. | |
233 | Entries beyond the first NUM_REGS are ignored. */ | |
234 | ||
235 | #define REGISTER_NAMES \ | |
236 | {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \ | |
237 | "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp", \ | |
238 | "ps", "pc", \ | |
239 | "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \ | |
240 | "fpcontrol", "fpstatus", "fpiaddr", "fpcode", "fpflags" } | |
241 | ||
242 | /* Register numbers of various important registers. | |
243 | Note that some of these values are "real" register numbers, | |
244 | and correspond to the general registers of the machine, | |
245 | and some are "phony" register numbers which are too large | |
246 | to be actual register numbers as far as the user is concerned | |
247 | but do serve to get the desired values when passed to read_register. */ | |
248 | ||
249 | #define A1_REGNUM 9 | |
250 | #define FP_REGNUM 14 /* Contains address of executing stack frame */ | |
251 | #define SP_REGNUM 15 /* Contains address of top of stack */ | |
252 | #define PS_REGNUM 16 /* Contains processor status */ | |
253 | #define PC_REGNUM 17 /* Contains program counter */ | |
254 | #if defined (HAVE_68881) | |
255 | #define FP0_REGNUM 18 /* Floating point register 0 */ | |
256 | #define FPC_REGNUM 26 /* 68881 control register */ | |
257 | #define FPS_REGNUM 27 /* 68881 status register */ | |
258 | #endif /* 68881. */ | |
259 | ||
260 | /* Store the address of the place in which to copy the structure the | |
261 | subroutine will return. This is called from call_function. */ | |
262 | ||
263 | #define STORE_STRUCT_RETURN(ADDR, SP) \ | |
264 | { write_register (A1_REGNUM, (ADDR)); } | |
265 | ||
266 | /* Extract from an array REGBUF containing the (raw) register state | |
267 | a function return value of type TYPE, and copy that, in virtual format, | |
268 | into VALBUF. This is assuming that floating point values are returned | |
269 | as doubles in d0/d1. */ | |
270 | ||
271 | #if !defined (EXTRACT_RETURN_VALUE) | |
272 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ | |
273 | bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE)) | |
274 | #endif | |
275 | ||
276 | /* Write into appropriate registers a function return value | |
277 | of type TYPE, given in virtual format. Assumes floats are passed | |
278 | in d0/d1. */ | |
279 | ||
280 | #if !defined (STORE_RETURN_VALUE) | |
281 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
282 | write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)) | |
283 | #endif | |
284 | ||
285 | /* Extract from an array REGBUF containing the (raw) register state | |
286 | the address in which a function should return its structure value, | |
287 | as a CORE_ADDR (or an expression that can be used as one). */ | |
288 | ||
e1ce8aa5 | 289 | #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) |
dd3b648e RP |
290 | \f |
291 | /* Describe the pointer in each stack frame to the previous stack frame | |
292 | (its caller). */ | |
293 | ||
294 | /* FRAME_CHAIN takes a frame's nominal address | |
295 | and produces the frame's chain-pointer. | |
296 | ||
297 | FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address | |
298 | and produces the nominal address of the caller frame. | |
299 | ||
300 | However, if FRAME_CHAIN_VALID returns zero, | |
301 | it means the given frame is the outermost one and has no caller. | |
302 | In that case, FRAME_CHAIN_COMBINE is not used. */ | |
303 | ||
304 | /* In the case of the 68000, the frame's nominal address | |
305 | is the address of a 4-byte word containing the calling frame's address. */ | |
306 | ||
307 | #define FRAME_CHAIN(thisframe) \ | |
308 | (outside_startup_file ((thisframe)->pc) ? \ | |
309 | read_memory_integer ((thisframe)->frame, 4) :\ | |
310 | 0) | |
311 | ||
312 | #define FRAME_CHAIN_VALID(chain, thisframe) \ | |
313 | (chain != 0 && outside_startup_file (FRAME_SAVED_PC (thisframe))) | |
314 | ||
315 | #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain) | |
316 | ||
317 | /* Define other aspects of the stack frame. */ | |
318 | ||
319 | /* A macro that tells us whether the function invocation represented | |
320 | by FI does not have a frame on the stack associated with it. If it | |
321 | does not, FRAMELESS is set to 1, else 0. */ | |
322 | #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ | |
323 | (FRAMELESS) = frameless_look_for_prologue(FI) | |
324 | ||
325 | #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4)) | |
326 | ||
327 | #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) | |
328 | ||
329 | #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) | |
330 | ||
331 | /* Set VAL to the number of args passed to frame described by FI. | |
332 | Can set VAL to -1, meaning no way to tell. */ | |
333 | ||
334 | /* We can't tell how many args there are | |
335 | now that the C compiler delays popping them. */ | |
336 | #if !defined (FRAME_NUM_ARGS) | |
337 | #define FRAME_NUM_ARGS(val,fi) (val = -1) | |
338 | #endif | |
339 | ||
340 | /* Return number of bytes at start of arglist that are not really args. */ | |
341 | ||
342 | #define FRAME_ARGS_SKIP 8 | |
343 | ||
344 | /* Put here the code to store, into a struct frame_saved_regs, | |
345 | the addresses of the saved registers of frame described by FRAME_INFO. | |
346 | This includes special registers such as pc and fp saved in special | |
347 | ways in the stack frame. sp is even more special: | |
348 | the address we return for it IS the sp for the next frame. */ | |
349 | ||
350 | #if !defined (FRAME_FIND_SAVED_REGS) | |
351 | #if defined (HAVE_68881) | |
352 | #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ | |
353 | { register int regnum; \ | |
354 | register int regmask; \ | |
355 | register CORE_ADDR next_addr; \ | |
356 | register CORE_ADDR pc; \ | |
357 | int nextinsn; \ | |
358 | bzero (&frame_saved_regs, sizeof frame_saved_regs); \ | |
359 | if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 8*12 - 4 \ | |
360 | && (frame_info)->pc <= (frame_info)->frame) \ | |
361 | { next_addr = (frame_info)->frame; \ | |
362 | pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 8*12 - 4; }\ | |
363 | else \ | |
364 | { pc = get_pc_function_start ((frame_info)->pc); \ | |
365 | /* Verify we have a link a6 instruction next; \ | |
366 | if not we lose. If we win, find the address above the saved \ | |
367 | regs using the amount of storage from the link instruction. */\ | |
368 | if (044016 == read_memory_integer (pc, 2)) \ | |
369 | next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4; \ | |
370 | else if (047126 == read_memory_integer (pc, 2)) \ | |
371 | next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2; \ | |
372 | else goto lose; \ | |
373 | /* If have an addal #-n, sp next, adjust next_addr. */ \ | |
374 | if ((0177777 & read_memory_integer (pc, 2)) == 0157774) \ | |
375 | next_addr += read_memory_integer (pc += 2, 4), pc += 4; \ | |
376 | } \ | |
377 | /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */ \ | |
378 | regmask = read_memory_integer (pc + 2, 2); \ | |
379 | /* But before that can come an fmovem. Check for it. */ \ | |
380 | nextinsn = 0xffff & read_memory_integer (pc, 2); \ | |
381 | if (0xf227 == nextinsn \ | |
382 | && (regmask & 0xff00) == 0xe000) \ | |
383 | { pc += 4; /* Regmask's low bit is for register fp7, the first pushed */ \ | |
384 | for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1) \ | |
385 | if (regmask & 1) \ | |
386 | (frame_saved_regs).regs[regnum] = (next_addr -= 12); \ | |
387 | regmask = read_memory_integer (pc + 2, 2); } \ | |
388 | if (0044327 == read_memory_integer (pc, 2)) \ | |
389 | { pc += 4; /* Regmask's low bit is for register 0, the first written */ \ | |
390 | for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) \ | |
391 | if (regmask & 1) \ | |
392 | (frame_saved_regs).regs[regnum] = (next_addr += 4) - 4; } \ | |
393 | else if (0044347 == read_memory_integer (pc, 2)) \ | |
394 | { pc += 4; /* Regmask's low bit is for register 15, the first pushed */ \ | |
395 | for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) \ | |
396 | if (regmask & 1) \ | |
397 | (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \ | |
398 | else if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2))) \ | |
399 | { regnum = 0xf & read_memory_integer (pc, 2); pc += 2; \ | |
400 | (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \ | |
401 | /* fmovemx to index of sp may follow. */ \ | |
402 | regmask = read_memory_integer (pc + 2, 2); \ | |
403 | nextinsn = 0xffff & read_memory_integer (pc, 2); \ | |
404 | if (0xf236 == nextinsn \ | |
405 | && (regmask & 0xff00) == 0xf000) \ | |
406 | { pc += 10; /* Regmask's low bit is for register fp0, the first written */ \ | |
407 | for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1) \ | |
408 | if (regmask & 1) \ | |
409 | (frame_saved_regs).regs[regnum] = (next_addr += 12) - 12; \ | |
410 | regmask = read_memory_integer (pc + 2, 2); } \ | |
411 | /* clrw -(sp); movw ccr,-(sp) may follow. */ \ | |
412 | if (0x426742e7 == read_memory_integer (pc, 4)) \ | |
413 | (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4); \ | |
414 | lose: ; \ | |
415 | (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8; \ | |
416 | (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \ | |
417 | (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4; \ | |
418 | } | |
419 | #else /* no 68881. */ | |
420 | #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ | |
421 | { register int regnum; \ | |
422 | register int regmask; \ | |
423 | register CORE_ADDR next_addr; \ | |
424 | register CORE_ADDR pc; \ | |
425 | bzero (&frame_saved_regs, sizeof frame_saved_regs); \ | |
426 | if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 4 \ | |
427 | && (frame_info)->pc <= (frame_info)->frame) \ | |
428 | { next_addr = (frame_info)->frame; \ | |
429 | pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4; }\ | |
430 | else \ | |
431 | { pc = get_pc_function_start ((frame_info)->pc); \ | |
432 | /* Verify we have a link a6 instruction next; \ | |
433 | if not we lose. If we win, find the address above the saved \ | |
434 | regs using the amount of storage from the link instruction. */\ | |
435 | if (044016 == read_memory_integer (pc, 2)) \ | |
436 | next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4; \ | |
437 | else if (047126 == read_memory_integer (pc, 2)) \ | |
438 | next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2; \ | |
439 | else goto lose; \ | |
440 | /* If have an addal #-n, sp next, adjust next_addr. */ \ | |
441 | if ((0177777 & read_memory_integer (pc, 2)) == 0157774) \ | |
442 | next_addr += read_memory_integer (pc += 2, 4), pc += 4; \ | |
443 | } \ | |
444 | /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */ \ | |
445 | regmask = read_memory_integer (pc + 2, 2); \ | |
446 | if (0044327 == read_memory_integer (pc, 2)) \ | |
447 | { pc += 4; /* Regmask's low bit is for register 0, the first written */ \ | |
448 | for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) \ | |
449 | if (regmask & 1) \ | |
450 | (frame_saved_regs).regs[regnum] = (next_addr += 4) - 4; } \ | |
451 | else if (0044347 == read_memory_integer (pc, 2)) \ | |
452 | { pc += 4; /* Regmask's low bit is for register 15, the first pushed */ \ | |
453 | for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) \ | |
454 | if (regmask & 1) \ | |
455 | (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \ | |
456 | else if (0x2f00 == 0xfff0 & read_memory_integer (pc, 2)) \ | |
457 | { regnum = 0xf & read_memory_integer (pc, 2); pc += 2; \ | |
458 | (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \ | |
459 | /* clrw -(sp); movw ccr,-(sp) may follow. */ \ | |
460 | if (0x426742e7 == read_memory_integer (pc, 4)) \ | |
461 | (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4); \ | |
462 | lose: ; \ | |
463 | (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8; \ | |
464 | (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \ | |
465 | (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4; \ | |
466 | } | |
467 | #endif /* no 68881. */ | |
468 | #endif /* no FIND_FRAME_SAVED_REGS. */ | |
469 | ||
470 | /* Note that stuff for calling inferior functions is not in this file | |
471 | because the call dummy is different for different breakpoint | |
472 | instructions, which are different on different systems. Perhaps | |
473 | they could be merged, but I haven't bothered. */ |