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