configure.in -- decide whether to configure gdb.hp; configure -- regenerated.
[deliverable/binutils-gdb.git] / gdb / v850-tdep.c
CommitLineData
e2810631 1/* Target-dependent code for the NEC V850 for GDB, the GNU debugger.
ac954805 2 Copyright 1996, Free Software Foundation, Inc.
e2810631
SG
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
e2810631
SG
20#include "defs.h"
21#include "frame.h"
22#include "inferior.h"
23#include "obstack.h"
24#include "target.h"
25#include "value.h"
26#include "bfd.h"
27#include "gdb_string.h"
e2810631 28#include "gdbcore.h"
23da411a
SG
29#include "symfile.h"
30
23da411a
SG
31/* Info gleaned from scanning a function's prologue. */
32
a638512f
SG
33struct pifsr /* Info about one saved reg */
34{
35 int framereg; /* Frame reg (SP or FP) */
36 int offset; /* Offset from framereg */
a490f8c1 37 int cur_frameoffset; /* Current frameoffset */
a638512f
SG
38 int reg; /* Saved register number */
39};
40
23da411a 41struct prologue_info
e5a2ac8b 42{
e5a2ac8b 43 int framereg;
23da411a
SG
44 int frameoffset;
45 int start_function;
a638512f 46 struct pifsr *pifsrs;
23da411a 47};
e5a2ac8b 48
dc1b349d
MS
49static CORE_ADDR v850_scan_prologue PARAMS ((CORE_ADDR pc,
50 struct prologue_info *fs));
98760eab
AC
51
52
53/* Should call_function allocate stack space for a struct return? */
54int
55v850_use_struct_convention (gcc_p, type)
56 int gcc_p;
57 struct type *type;
58{
59 return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 4);
60}
61
23da411a 62\f
dc1b349d
MS
63/* Function: scan_prologue
64 Scan the prologue of the function that contains PC, and record what
65 we find in PI. PI->fsr must be zeroed by the called. Returns the
66 pc after the prologue. Note that the addresses saved in pi->fsr
67 are actually just frame relative (negative offsets from the frame
68 pointer). This is because we don't know the actual value of the
69 frame pointer yet. In some circumstances, the frame pointer can't
70 be determined till after we have scanned the prologue. */
23da411a
SG
71
72static CORE_ADDR
dc1b349d 73v850_scan_prologue (pc, pi)
23da411a
SG
74 CORE_ADDR pc;
75 struct prologue_info *pi;
76{
77 CORE_ADDR func_addr, prologue_end, current_pc;
a490f8c1 78 struct pifsr *pifsr, *pifsr_tmp;
23da411a 79 int fp_used;
b71f8719 80 int ep_used;
a490f8c1
MM
81 int reg;
82 CORE_ADDR save_pc, save_end;
83 int regsave_func_p;
84 int current_sp_size;
0b019fa1 85 int r12_tmp;
e5a2ac8b
SG
86
87 /* First, figure out the bounds of the prologue so that we can limit the
88 search to something reasonable. */
89
23da411a 90 if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
e5a2ac8b 91 {
23da411a
SG
92 struct symtab_and_line sal;
93
e5a2ac8b
SG
94 sal = find_pc_line (func_addr, 0);
95
23da411a
SG
96 if (func_addr == entry_point_address ())
97 pi->start_function = 1;
98 else
99 pi->start_function = 0;
100
a638512f 101#if 0
ac954805 102 if (sal.line == 0)
23da411a 103 prologue_end = pc;
ac954805
SG
104 else
105 prologue_end = sal.end;
a638512f
SG
106#else
107 prologue_end = pc;
108#endif
e5a2ac8b
SG
109 }
110 else
23da411a
SG
111 { /* We're in the boondocks */
112 func_addr = pc - 100;
113 prologue_end = pc;
114 }
e5a2ac8b 115
23da411a 116 prologue_end = min (prologue_end, pc);
e5a2ac8b
SG
117
118 /* Now, search the prologue looking for instructions that setup fp, save
23da411a
SG
119 rp, adjust sp and such. We also record the frame offset of any saved
120 registers. */
e5a2ac8b 121
23da411a
SG
122 pi->frameoffset = 0;
123 pi->framereg = SP_REGNUM;
124 fp_used = 0;
b71f8719 125 ep_used = 0;
a638512f 126 pifsr = pi->pifsrs;
a490f8c1
MM
127 regsave_func_p = 0;
128 save_pc = 0;
129 save_end = 0;
0b019fa1 130 r12_tmp = 0;
a490f8c1
MM
131
132#ifdef DEBUG
133 printf_filtered ("Current_pc = 0x%.8lx, prologue_end = 0x%.8lx\n",
134 (long)func_addr, (long)prologue_end);
135#endif
e5a2ac8b
SG
136
137 for (current_pc = func_addr; current_pc < prologue_end; current_pc += 2)
138 {
139 int insn;
140
a490f8c1
MM
141#ifdef DEBUG
142 printf_filtered ("0x%.8lx ", (long)current_pc);
143 (*tm_print_insn) (current_pc, &tm_print_insn_info);
144#endif
145
6420594b 146 insn = read_memory_unsigned_integer (current_pc, 2);
e5a2ac8b 147
a490f8c1
MM
148 if ((insn & 0xffc0) == ((10 << 11) | 0x0780) && !regsave_func_p)
149 { /* jarl <func>,10 */
150 long low_disp = read_memory_unsigned_integer (current_pc + 2, 2) & ~ (long) 1;
151 long disp = (((((insn & 0x3f) << 16) + low_disp)
152 & ~ (long) 1) ^ 0x00200000) - 0x00200000;
153
154 save_pc = current_pc;
155 save_end = prologue_end;
156 regsave_func_p = 1;
157 current_pc += disp - 2;
158 prologue_end = (current_pc
159 + (2 * 3) /* moves to/from ep */
160 + 4 /* addi <const>,sp,sp */
161 + 2 /* jmp [r10] */
162 + (2 * 12) /* sst.w to save r2, r20-r29, r31 */
163 + 20); /* slop area */
164
165#ifdef DEBUG
166 printf_filtered ("\tfound jarl <func>,r10, disp = %ld, low_disp = %ld, new pc = 0x%.8lx\n",
167 disp, low_disp, (long)current_pc + 2);
168#endif
169 continue;
170 }
171 else if ((insn & 0xffe0) == 0x0060 && regsave_func_p)
172 { /* jmp after processing register save function */
173 current_pc = save_pc + 2;
174 prologue_end = save_end;
175 regsave_func_p = 0;
176#ifdef DEBUG
177 printf_filtered ("\tfound jmp after regsave func");
178#endif
179 }
180 else if ((insn & 0x07c0) == 0x0780 /* jarl or jr */
181 || (insn & 0xffe0) == 0x0060 /* jmp */
182 || (insn & 0x0780) == 0x0580) /* branch */
183 {
184#ifdef DEBUG
185 printf_filtered ("\n");
186#endif
187 break; /* Ran into end of prologue */
188 }
189
190 else if ((insn & 0xffe0) == ((SP_REGNUM << 11) | 0x0240)) /* add <imm>,sp */
191 pi->frameoffset += ((insn & 0x1f) ^ 0x10) - 0x10;
192 else if (insn == ((SP_REGNUM << 11) | 0x0600 | SP_REGNUM)) /* addi <imm>,sp,sp */
193 pi->frameoffset += read_memory_integer (current_pc + 2, 2);
ea45efcf 194 else if (insn == ((FP_RAW_REGNUM << 11) | 0x0000 | SP_REGNUM)) /* mov sp,fp */
e5a2ac8b 195 {
23da411a 196 fp_used = 1;
ea45efcf 197 pi->framereg = FP_RAW_REGNUM;
23da411a 198 }
a490f8c1 199
0b019fa1
MM
200 else if (insn == ((R12_REGNUM << 11) | 0x0640 | R0_REGNUM)) /* movhi hi(const),r0,r12 */
201 r12_tmp = read_memory_integer (current_pc + 2, 2) << 16;
202 else if (insn == ((R12_REGNUM << 11) | 0x0620 | R12_REGNUM)) /* movea lo(const),r12,r12 */
203 r12_tmp += read_memory_integer (current_pc + 2, 2);
204 else if (insn == ((SP_REGNUM << 11) | 0x01c0 | R12_REGNUM) && r12_tmp) /* add r12,sp */
205 pi->frameoffset = r12_tmp;
a490f8c1 206 else if (insn == ((EP_REGNUM << 11) | 0x0000 | SP_REGNUM)) /* mov sp,ep */
b71f8719 207 ep_used = 1;
a490f8c1 208 else if (insn == ((EP_REGNUM << 11) | 0x0000 | R1_REGNUM)) /* mov r1,ep */
b71f8719 209 ep_used = 0;
0b019fa1 210 else if (((insn & 0x07ff) == (0x0760 | SP_REGNUM) /* st.w <reg>,<offset>[sp] */
b71f8719 211 || (fp_used
ea45efcf 212 && (insn & 0x07ff) == (0x0760 | FP_RAW_REGNUM))) /* st.w <reg>,<offset>[fp] */
a490f8c1
MM
213 && pifsr
214 && (((reg = (insn >> 11) & 0x1f) >= SAVE1_START_REGNUM && reg <= SAVE1_END_REGNUM)
215 || (reg >= SAVE2_START_REGNUM && reg <= SAVE2_END_REGNUM)
216 || (reg >= SAVE3_START_REGNUM && reg <= SAVE3_END_REGNUM)))
b71f8719 217 {
a490f8c1 218 pifsr->reg = reg;
b71f8719 219 pifsr->offset = read_memory_integer (current_pc + 2, 2) & ~1;
a490f8c1
MM
220 pifsr->cur_frameoffset = pi->frameoffset;
221#ifdef DEBUG
222 printf_filtered ("\tSaved register r%d, offset %d", reg, pifsr->offset);
223#endif
b71f8719
MM
224 pifsr++;
225 }
226
a490f8c1 227 else if (ep_used /* sst.w <reg>,<offset>[ep] */
b71f8719 228 && ((insn & 0x0781) == 0x0501)
a490f8c1
MM
229 && pifsr
230 && (((reg = (insn >> 11) & 0x1f) >= SAVE1_START_REGNUM && reg <= SAVE1_END_REGNUM)
231 || (reg >= SAVE2_START_REGNUM && reg <= SAVE2_END_REGNUM)
232 || (reg >= SAVE3_START_REGNUM && reg <= SAVE3_END_REGNUM)))
b71f8719 233 {
a490f8c1
MM
234 pifsr->reg = reg;
235 pifsr->offset = (insn & 0x007e) << 1;
236 pifsr->cur_frameoffset = pi->frameoffset;
237#ifdef DEBUG
238 printf_filtered ("\tSaved register r%d, offset %d", reg, pifsr->offset);
239#endif
b71f8719
MM
240 pifsr++;
241 }
6420594b
SG
242
243 if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */
244 current_pc += 2;
a490f8c1
MM
245
246#ifdef DEBUG
247 printf_filtered ("\n");
248#endif
e5a2ac8b
SG
249 }
250
a638512f
SG
251 if (pifsr)
252 pifsr->framereg = 0; /* Tie off last entry */
253
a490f8c1
MM
254 /* Fix up any offsets to the final offset. If a frame pointer was created, use it
255 instead of the stack pointer. */
256 for (pifsr_tmp = pi->pifsrs; pifsr_tmp && pifsr_tmp != pifsr; pifsr_tmp++)
257 {
258 pifsr_tmp->offset -= pi->frameoffset - pifsr_tmp->cur_frameoffset;
259 pifsr_tmp->framereg = pi->framereg;
260
261#ifdef DEBUG
262 printf_filtered ("Saved register r%d, offset = %d, framereg = r%d\n",
263 pifsr_tmp->reg, pifsr_tmp->offset, pifsr_tmp->framereg);
264#endif
265 }
266
267#ifdef DEBUG
268 printf_filtered ("Framereg = r%d, frameoffset = %d\n", pi->framereg, pi->frameoffset);
269#endif
270
23da411a 271 return current_pc;
e5a2ac8b
SG
272}
273
dc1b349d
MS
274/* Function: init_extra_frame_info
275 Setup the frame's frame pointer, pc, and frame addresses for saved
276 registers. Most of the work is done in scan_prologue().
e5a2ac8b 277
23da411a
SG
278 Note that when we are called for the last frame (currently active frame),
279 that fi->pc and fi->frame will already be setup. However, fi->frame will
280 be valid only if this routine uses FP. For previous frames, fi-frame will
281 always be correct (since that is derived from v850_frame_chain ()).
282
283 We can be called with the PC in the call dummy under two circumstances.
284 First, during normal backtracing, second, while figuring out the frame
dc1b349d 285 pointer just prior to calling the target function (see run_stack_dummy). */
23da411a
SG
286
287void
288v850_init_extra_frame_info (fi)
e5a2ac8b 289 struct frame_info *fi;
e5a2ac8b 290{
23da411a 291 struct prologue_info pi;
a638512f 292 struct pifsr pifsrs[NUM_REGS + 1], *pifsr;
23da411a
SG
293 int reg;
294
295 if (fi->next)
296 fi->pc = FRAME_SAVED_PC (fi->next);
297
298 memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
299
300 /* The call dummy doesn't save any registers on the stack, so we can return
301 now. */
dc1b349d 302 if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
23da411a 303 return;
ac954805 304
a638512f 305 pi.pifsrs = pifsrs;
e5a2ac8b 306
dc1b349d 307 v850_scan_prologue (fi->pc, &pi);
23da411a 308
a638512f
SG
309 if (!fi->next && pi.framereg == SP_REGNUM)
310 fi->frame = read_register (pi.framereg) - pi.frameoffset;
23da411a 311
a638512f
SG
312 for (pifsr = pifsrs; pifsr->framereg; pifsr++)
313 {
314 fi->fsr.regs[pifsr->reg] = pifsr->offset + fi->frame;
315
316 if (pifsr->framereg == SP_REGNUM)
317 fi->fsr.regs[pifsr->reg] += pi.frameoffset;
318 }
e5a2ac8b
SG
319}
320
dc1b349d
MS
321/* Function: frame_chain
322 Figure out the frame prior to FI. Unfortunately, this involves
323 scanning the prologue of the caller, which will also be done
324 shortly by v850_init_extra_frame_info. For the dummy frame, we
325 just return the stack pointer that was in use at the time the
326 function call was made. */
23da411a 327
e5a2ac8b
SG
328CORE_ADDR
329v850_frame_chain (fi)
330 struct frame_info *fi;
331{
23da411a 332 struct prologue_info pi;
dc1b349d 333 CORE_ADDR callers_pc, fp;
e5a2ac8b
SG
334
335 /* First, find out who called us */
ac954805 336 callers_pc = FRAME_SAVED_PC (fi);
dc1b349d 337 /* If caller is a call-dummy, then our FP bears no relation to his FP! */
ea45efcf 338 fp = v850_find_callers_reg (fi, FP_RAW_REGNUM);
dc1b349d
MS
339 if (PC_IN_CALL_DUMMY(callers_pc, fp, fp))
340 return fp; /* caller is call-dummy: return oldest value of FP */
ac954805 341
dc1b349d
MS
342 /* Caller is NOT a call-dummy, so everything else should just work.
343 Even if THIS frame is a call-dummy! */
a638512f 344 pi.pifsrs = NULL;
e5a2ac8b 345
dc1b349d 346 v850_scan_prologue (callers_pc, &pi);
e5a2ac8b 347
23da411a
SG
348 if (pi.start_function)
349 return 0; /* Don't chain beyond the start function */
ac954805 350
ea45efcf 351 if (pi.framereg == FP_RAW_REGNUM)
23da411a 352 return v850_find_callers_reg (fi, pi.framereg);
e5a2ac8b 353
23da411a
SG
354 return fi->frame - pi.frameoffset;
355}
e5a2ac8b 356
dc1b349d
MS
357/* Function: find_callers_reg
358 Find REGNUM on the stack. Otherwise, it's in an active register.
359 One thing we might want to do here is to check REGNUM against the
360 clobber mask, and somehow flag it as invalid if it isn't saved on
361 the stack somewhere. This would provide a graceful failure mode
362 when trying to get the value of caller-saves registers for an inner
363 frame. */
e5a2ac8b 364
23da411a
SG
365CORE_ADDR
366v850_find_callers_reg (fi, regnum)
367 struct frame_info *fi;
368 int regnum;
369{
23da411a 370 for (; fi; fi = fi->next)
dc1b349d
MS
371 if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
372 return generic_read_register_dummy (fi->pc, fi->frame, regnum);
23da411a 373 else if (fi->fsr.regs[regnum] != 0)
dc1b349d
MS
374 return read_memory_unsigned_integer (fi->fsr.regs[regnum],
375 REGISTER_RAW_SIZE(regnum));
e5a2ac8b 376
23da411a 377 return read_register (regnum);
e5a2ac8b
SG
378}
379
dc1b349d
MS
380/* Function: skip_prologue
381 Return the address of the first code past the prologue of the function. */
382
e5a2ac8b
SG
383CORE_ADDR
384v850_skip_prologue (pc)
385 CORE_ADDR pc;
386{
387 CORE_ADDR func_addr, func_end;
388
389 /* See what the symbol table says */
390
391 if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
392 {
393 struct symtab_and_line sal;
394
395 sal = find_pc_line (func_addr, 0);
396
ac954805 397 if (sal.line != 0 && sal.end < func_end)
e5a2ac8b
SG
398 return sal.end;
399 else
ac954805
SG
400 /* Either there's no line info, or the line after the prologue is after
401 the end of the function. In this case, there probably isn't a
402 prologue. */
e5a2ac8b
SG
403 return pc;
404 }
405
406/* We can't find the start of this function, so there's nothing we can do. */
407 return pc;
408}
409
dc1b349d
MS
410/* Function: pop_frame
411 This routine gets called when either the user uses the `return'
412 command, or the call dummy breakpoint gets hit. */
ac954805
SG
413
414void
e5a2ac8b
SG
415v850_pop_frame (frame)
416 struct frame_info *frame;
417{
418 int regnum;
419
dc1b349d
MS
420 if (PC_IN_CALL_DUMMY(frame->pc, frame->frame, frame->frame))
421 generic_pop_dummy_frame ();
23da411a
SG
422 else
423 {
424 write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
ac954805 425
23da411a
SG
426 for (regnum = 0; regnum < NUM_REGS; regnum++)
427 if (frame->fsr.regs[regnum] != 0)
428 write_register (regnum,
dc1b349d
MS
429 read_memory_unsigned_integer (frame->fsr.regs[regnum],
430 REGISTER_RAW_SIZE(regnum)));
e5a2ac8b 431
23da411a
SG
432 write_register (SP_REGNUM, FRAME_FP (frame));
433 }
e5a2ac8b 434
e5a2ac8b 435 flush_cached_frames ();
e5a2ac8b 436}
ac954805 437
dc1b349d
MS
438/* Function: push_arguments
439 Setup arguments and RP for a call to the target. First four args
440 go in R6->R9, subsequent args go into sp + 16 -> sp + ... Structs
441 are passed by reference. 64 bit quantities (doubles and long
442 longs) may be split between the regs and the stack. When calling a
443 function that returns a struct, a pointer to the struct is passed
444 in as a secret first argument (always in R6).
ac954805 445
dc1b349d
MS
446 Stack space for the args has NOT been allocated: that job is up to us.
447 */
ac954805
SG
448
449CORE_ADDR
450v850_push_arguments (nargs, args, sp, struct_return, struct_addr)
451 int nargs;
452 value_ptr *args;
453 CORE_ADDR sp;
454 unsigned char struct_return;
455 CORE_ADDR struct_addr;
456{
457 int argreg;
458 int argnum;
dc1b349d
MS
459 int len = 0;
460 int stack_offset;
ac954805 461
dc1b349d
MS
462 /* First, just for safety, make sure stack is aligned */
463 sp &= ~3;
464
465 /* Now make space on the stack for the args. */
466 for (argnum = 0; argnum < nargs; argnum++)
467 len += ((TYPE_LENGTH(VALUE_TYPE(args[argnum])) + 3) & ~3);
468 sp -= len; /* possibly over-allocating, but it works... */
469 /* (you might think we could allocate 16 bytes */
470 /* less, but the ABI seems to use it all! ) */
687f4e23 471 argreg = ARG0_REGNUM;
ac954805 472
dc1b349d 473 /* the struct_return pointer occupies the first parameter-passing reg */
ac954805 474 if (struct_return)
ac954805 475 write_register (argreg++, struct_addr);
ac954805 476
dc1b349d
MS
477 stack_offset = 16;
478 /* The offset onto the stack at which we will start copying parameters
479 (after the registers are used up) begins at 16 rather than at zero.
480 I don't really know why, that's just the way it seems to work. */
481
482 /* Now load as many as possible of the first arguments into
483 registers, and push the rest onto the stack. There are 16 bytes
484 in four registers available. Loop thru args from first to last. */
ac954805
SG
485 for (argnum = 0; argnum < nargs; argnum++)
486 {
487 int len;
488 char *val;
dc1b349d 489 char valbuf[REGISTER_RAW_SIZE(ARG0_REGNUM)];
ac954805
SG
490
491 if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT
492 && TYPE_LENGTH (VALUE_TYPE (*args)) > 8)
493 {
494 store_address (valbuf, 4, VALUE_ADDRESS (*args));
495 len = 4;
496 val = valbuf;
497 }
498 else
499 {
500 len = TYPE_LENGTH (VALUE_TYPE (*args));
501 val = (char *)VALUE_CONTENTS (*args);
502 }
503
504 while (len > 0)
687f4e23 505 if (argreg <= ARGLAST_REGNUM)
ac954805
SG
506 {
507 CORE_ADDR regval;
508
509 regval = extract_address (val, REGISTER_RAW_SIZE (argreg));
510 write_register (argreg, regval);
511
512 len -= REGISTER_RAW_SIZE (argreg);
513 val += REGISTER_RAW_SIZE (argreg);
514 argreg++;
515 }
516 else
517 {
dc1b349d 518 write_memory (sp + stack_offset, val, 4);
ac954805
SG
519
520 len -= 4;
521 val += 4;
dc1b349d 522 stack_offset += 4;
ac954805
SG
523 }
524 args++;
525 }
dc1b349d
MS
526 return sp;
527}
ac954805 528
dc1b349d
MS
529/* Function: push_return_address (pc)
530 Set up the return address for the inferior function call.
531 Needed for targets where we don't actually execute a JSR/BSR instruction */
532
dc1b349d
MS
533CORE_ADDR
534v850_push_return_address (pc, sp)
535 CORE_ADDR pc;
536 CORE_ADDR sp;
537{
409f64ae 538 write_register (RP_REGNUM, CALL_DUMMY_ADDRESS ());
ac954805
SG
539 return sp;
540}
dc1b349d
MS
541
542/* Function: frame_saved_pc
543 Find the caller of this frame. We do this by seeing if RP_REGNUM
544 is saved in the stack anywhere, otherwise we get it from the
545 registers. If the inner frame is a dummy frame, return its PC
546 instead of RP, because that's where "caller" of the dummy-frame
547 will be found. */
548
549CORE_ADDR
550v850_frame_saved_pc (fi)
551 struct frame_info *fi;
552{
553 if (PC_IN_CALL_DUMMY(fi->pc, fi->frame, fi->frame))
554 return generic_read_register_dummy(fi->pc, fi->frame, PC_REGNUM);
555 else
556 return v850_find_callers_reg (fi, RP_REGNUM);
557}
558
559void
560get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
561 char *raw_buffer;
562 int *optimized;
563 CORE_ADDR *addrp;
564 struct frame_info *frame;
565 int regnum;
566 enum lval_type *lval;
567{
568 generic_get_saved_register (raw_buffer, optimized, addrp,
569 frame, regnum, lval);
570}
571
572
573/* Function: fix_call_dummy
574 Pokes the callee function's address into the CALL_DUMMY assembly stub.
575 Assumes that the CALL_DUMMY looks like this:
576 jarl <offset24>, r31
577 trap
578 */
579
580int
581v850_fix_call_dummy (dummy, sp, fun, nargs, args, type, gcc_p)
582 char *dummy;
583 CORE_ADDR sp;
584 CORE_ADDR fun;
585 int nargs;
586 value_ptr *args;
587 struct type *type;
588 int gcc_p;
589{
590 long offset24;
dc1b349d 591
409f64ae 592 offset24 = (long) fun - (long) entry_point_address ();
dc1b349d
MS
593 offset24 &= 0x3fffff;
594 offset24 |= 0xff800000; /* jarl <offset24>, r31 */
595
596 store_unsigned_integer ((unsigned int *)&dummy[2], 2, offset24 & 0xffff);
597 store_unsigned_integer ((unsigned int *)&dummy[0], 2, offset24 >> 16);
598 return 0;
599}
600
e2810631 601void
dc1b349d 602_initialize_v850_tdep ()
e2810631
SG
603{
604 tm_print_insn = print_insn_v850;
605}
This page took 0.156966 seconds and 4 git commands to generate.