1 /* Target-dependent code for the S+core architecture, for GDB,
4 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
5 Free Software Foundation, Inc.
7 Contributed by Qinwei (qinwei@sunnorth.com.cn)
8 Contributed by Ching-Peng Lin (cplin@sunplus.com)
10 This file is part of GDB.
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26 #include "gdb_assert.h"
32 #include "arch-utils.h"
36 #include "frame-unwind.h"
37 #include "frame-base.h"
38 #include "trad-frame.h"
39 #include "dwarf2-frame.h"
40 #include "score-tdep.h"
42 #define G_FLD(_i,_ms,_ls) \
43 ((unsigned)((_i) << (31 - (_ms))) >> (31 - (_ms) + (_ls)))
47 unsigned long long raw
;
51 struct score_frame_cache
55 struct trad_frame_saved_reg
*saved_regs
;
58 static int target_mach
= bfd_mach_score7
;
61 score_register_type (struct gdbarch
*gdbarch
, int regnum
)
63 gdb_assert (regnum
>= 0
64 && regnum
< ((target_mach
== bfd_mach_score7
)
65 ? SCORE7_NUM_REGS
: SCORE3_NUM_REGS
));
66 return builtin_type (gdbarch
)->builtin_uint32
;
70 score_unwind_sp (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
72 return frame_unwind_register_unsigned (next_frame
, SCORE_SP_REGNUM
);
76 score_unwind_pc (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
78 return frame_unwind_register_unsigned (next_frame
, SCORE_PC_REGNUM
);
82 score7_register_name (struct gdbarch
*gdbarch
, int regnum
)
84 const char *score_register_names
[] = {
85 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
86 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
87 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
88 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
90 "PSR", "COND", "ECR", "EXCPVEC", "CCR",
91 "EPC", "EMA", "TLBLOCK", "TLBPT", "PEADDR",
92 "TLBRPT", "PEVN", "PECTX", "LIMPFN", "LDMPFN",
93 "PREV", "DREG", "PC", "DSAVE", "COUNTER",
94 "LDCR", "STCR", "CEH", "CEL",
97 gdb_assert (regnum
>= 0 && regnum
< SCORE7_NUM_REGS
);
98 return score_register_names
[regnum
];
102 score3_register_name (struct gdbarch
*gdbarch
, int regnum
)
104 const char *score_register_names
[] = {
105 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
106 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
107 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
108 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
110 "PSR", "COND", "ECR", "EXCPVEC", "CCR",
111 "EPC", "EMA", "PREV", "DREG", "DSAVE",
112 "COUNTER", "LDCR", "STCR", "CEH", "CEL",
116 gdb_assert (regnum
>= 0 && regnum
< SCORE3_NUM_REGS
);
117 return score_register_names
[regnum
];
122 score_register_sim_regno (struct gdbarch
*gdbarch
, int regnum
)
124 gdb_assert (regnum
>= 0
125 && regnum
< ((target_mach
== bfd_mach_score7
)
126 ? SCORE7_NUM_REGS
: SCORE3_NUM_REGS
));
132 score_print_insn (bfd_vma memaddr
, struct disassemble_info
*info
)
134 if (info
->endian
== BFD_ENDIAN_BIG
)
135 return print_insn_big_score (memaddr
, info
);
137 return print_insn_little_score (memaddr
, info
);
141 score7_fetch_inst (struct gdbarch
*gdbarch
, CORE_ADDR addr
, char *memblock
)
143 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
144 static inst_t inst
= { 0, 0, 0 };
145 char buf
[SCORE_INSTLEN
] = { 0 };
149 if (target_has_execution
&& memblock
!= NULL
)
151 /* Fetch instruction from local MEMBLOCK. */
152 memcpy (buf
, memblock
, SCORE_INSTLEN
);
156 /* Fetch instruction from target. */
157 ret
= target_read_memory (addr
& ~0x3, buf
, SCORE_INSTLEN
);
160 error (_("Error: target_read_memory in file:%s, line:%d!"),
166 inst
.raw
= extract_unsigned_integer (buf
, SCORE_INSTLEN
, byte_order
);
167 inst
.len
= (inst
.raw
& 0x80008000) ? 4 : 2;
168 inst
.v
= ((inst
.raw
>> 16 & 0x7FFF) << 15) | (inst
.raw
& 0x7FFF);
169 big
= (byte_order
== BFD_ENDIAN_BIG
);
172 if (big
^ ((addr
& 0x2) == 2))
173 inst
.v
= G_FLD (inst
.v
, 29, 15);
175 inst
.v
= G_FLD (inst
.v
, 14, 0);
181 score3_adjust_pc_and_fetch_inst (CORE_ADDR
*pcptr
, int *lenptr
,
182 enum bfd_endian byte_order
)
184 static inst_t inst
= { 0, 0, 0 };
191 /* raw table 1 (column 2, 3, 4)
195 table 2 (column 1, 2, 3)
201 static const struct breakplace bk_table
[16] =
223 #define EXTRACT_LEN 2
224 CORE_ADDR adjust_pc
= *pcptr
& ~0x1;
226 gdb_byte buf
[5][EXTRACT_LEN
] =
236 unsigned int cbits
= 0;
245 for (i
= 0; i
< 5; i
++)
247 ret
= target_read_memory (adjust_pc
+ 2 * i
, buf
[i
], EXTRACT_LEN
);
253 error (_("Error: target_read_memory in file:%s, line:%d!"),
257 raw
= extract_unsigned_integer (buf
[i
], EXTRACT_LEN
, byte_order
);
258 cbits
= (cbits
<< 1) | (raw
>> 15);
265 cbits
= (cbits
>> 1) & 0x7;
271 cbits
= (cbits
>> 2) & 0x7;
272 bk_index
= cbits
+ 8;
275 gdb_assert (!((bk_table
[bk_index
].break_offset
== 0)
276 && (bk_table
[bk_index
].inst_len
== 0)));
278 inst
.len
= bk_table
[bk_index
].inst_len
;
280 i
= (bk_table
[bk_index
].break_offset
+ 4) / 2;
281 count
= inst
.len
/ 2;
282 for (; count
> 0; i
++, count
--)
284 inst
.raw
= (inst
.raw
<< 16)
285 | extract_unsigned_integer (buf
[i
], EXTRACT_LEN
, byte_order
);
291 inst
.v
= inst
.raw
& 0x7FFF;
294 inst
.v
= ((inst
.raw
>> 16 & 0x7FFF) << 15) | (inst
.raw
& 0x7FFF);
297 inst
.v
= ((inst
.raw
>> 32 & 0x7FFF) << 30)
298 | ((inst
.raw
>> 16 & 0x7FFF) << 15) | (inst
.raw
& 0x7FFF);
303 *pcptr
= adjust_pc
+ bk_table
[bk_index
].break_offset
;
305 *lenptr
= bk_table
[bk_index
].inst_len
;
312 static const gdb_byte
*
313 score7_breakpoint_from_pc (struct gdbarch
*gdbarch
, CORE_ADDR
*pcptr
,
316 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
317 gdb_byte buf
[SCORE_INSTLEN
] = { 0 };
321 if ((ret
= target_read_memory (*pcptr
& ~0x3, buf
, SCORE_INSTLEN
)) != 0)
323 error (_("Error: target_read_memory in file:%s, line:%d!"),
326 raw
= extract_unsigned_integer (buf
, SCORE_INSTLEN
, byte_order
);
328 if (byte_order
== BFD_ENDIAN_BIG
)
330 if (!(raw
& 0x80008000))
332 /* 16bits instruction. */
333 static gdb_byte big_breakpoint16
[] = { 0x60, 0x02 };
335 *lenptr
= sizeof (big_breakpoint16
);
336 return big_breakpoint16
;
340 /* 32bits instruction. */
341 static gdb_byte big_breakpoint32
[] = { 0x80, 0x00, 0x80, 0x06 };
343 *lenptr
= sizeof (big_breakpoint32
);
344 return big_breakpoint32
;
349 if (!(raw
& 0x80008000))
351 /* 16bits instruction. */
352 static gdb_byte little_breakpoint16
[] = { 0x02, 0x60 };
354 *lenptr
= sizeof (little_breakpoint16
);
355 return little_breakpoint16
;
359 /* 32bits instruction. */
360 static gdb_byte little_breakpoint32
[] = { 0x06, 0x80, 0x00, 0x80 };
362 *lenptr
= sizeof (little_breakpoint32
);
363 return little_breakpoint32
;
368 static const gdb_byte
*
369 score3_breakpoint_from_pc (struct gdbarch
*gdbarch
, CORE_ADDR
*pcptr
,
372 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
373 CORE_ADDR adjust_pc
= *pcptr
;
375 static gdb_byte score_break_insns
[6][6] = {
376 /* The following three instructions are big endian. */
378 { 0x80, 0x00, 0x00, 0x06 },
379 { 0x80, 0x00, 0x80, 0x00, 0x00, 0x00 },
380 /* The following three instructions are little endian. */
382 { 0x00, 0x80, 0x06, 0x00 },
383 { 0x00, 0x80, 0x00, 0x80, 0x00, 0x00 }};
388 score3_adjust_pc_and_fetch_inst (&adjust_pc
, &len
, byte_order
);
390 index
= ((byte_order
== BFD_ENDIAN_BIG
) ? 0 : 3) + (len
/ 2 - 1);
391 p
= score_break_insns
[index
];
400 score_adjust_breakpoint_address (struct gdbarch
*gdbarch
, CORE_ADDR bpaddr
)
402 CORE_ADDR adjust_pc
= bpaddr
;
404 if (target_mach
== bfd_mach_score3
)
405 score3_adjust_pc_and_fetch_inst (&adjust_pc
, NULL
,
406 gdbarch_byte_order (gdbarch
));
408 adjust_pc
= align_down (adjust_pc
, 2);
414 score_frame_align (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
416 return align_down (addr
, 16);
420 score_xfer_register (struct regcache
*regcache
, int regnum
, int length
,
421 enum bfd_endian endian
, gdb_byte
*readbuf
,
422 const gdb_byte
*writebuf
, int buf_offset
)
425 gdb_assert (regnum
>= 0
426 && regnum
< ((target_mach
== bfd_mach_score7
)
427 ? SCORE7_NUM_REGS
: SCORE3_NUM_REGS
));
432 reg_offset
= SCORE_REGSIZE
- length
;
434 case BFD_ENDIAN_LITTLE
:
437 case BFD_ENDIAN_UNKNOWN
:
441 error (_("Error: score_xfer_register in file:%s, line:%d!"),
446 regcache_cooked_read_part (regcache
, regnum
, reg_offset
, length
,
447 readbuf
+ buf_offset
);
448 if (writebuf
!= NULL
)
449 regcache_cooked_write_part (regcache
, regnum
, reg_offset
, length
,
450 writebuf
+ buf_offset
);
453 static enum return_value_convention
454 score_return_value (struct gdbarch
*gdbarch
, struct type
*func_type
,
455 struct type
*type
, struct regcache
*regcache
,
456 gdb_byte
* readbuf
, const gdb_byte
* writebuf
)
458 if (TYPE_CODE (type
) == TYPE_CODE_STRUCT
459 || TYPE_CODE (type
) == TYPE_CODE_UNION
460 || TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
461 return RETURN_VALUE_STRUCT_CONVENTION
;
466 for (offset
= 0, regnum
= SCORE_A0_REGNUM
;
467 offset
< TYPE_LENGTH (type
);
468 offset
+= SCORE_REGSIZE
, regnum
++)
470 int xfer
= SCORE_REGSIZE
;
472 if (offset
+ xfer
> TYPE_LENGTH (type
))
473 xfer
= TYPE_LENGTH (type
) - offset
;
474 score_xfer_register (regcache
, regnum
, xfer
,
475 gdbarch_byte_order(gdbarch
),
476 readbuf
, writebuf
, offset
);
478 return RETURN_VALUE_REGISTER_CONVENTION
;
482 static struct frame_id
483 score_dummy_id (struct gdbarch
*gdbarch
, struct frame_info
*this_frame
)
485 return frame_id_build (get_frame_register_unsigned (this_frame
,
487 get_frame_pc (this_frame
));
491 score_type_needs_double_align (struct type
*type
)
493 enum type_code typecode
= TYPE_CODE (type
);
495 if ((typecode
== TYPE_CODE_INT
&& TYPE_LENGTH (type
) == 8)
496 || (typecode
== TYPE_CODE_FLT
&& TYPE_LENGTH (type
) == 8))
498 else if (typecode
== TYPE_CODE_STRUCT
|| typecode
== TYPE_CODE_UNION
)
502 n
= TYPE_NFIELDS (type
);
503 for (i
= 0; i
< n
; i
++)
504 if (score_type_needs_double_align (TYPE_FIELD_TYPE (type
, i
)))
512 score_push_dummy_call (struct gdbarch
*gdbarch
, struct value
*function
,
513 struct regcache
*regcache
, CORE_ADDR bp_addr
,
514 int nargs
, struct value
**args
, CORE_ADDR sp
,
515 int struct_return
, CORE_ADDR struct_addr
)
517 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
521 CORE_ADDR stack_offset
= 0;
524 /* Step 1, Save RA. */
525 regcache_cooked_write_unsigned (regcache
, SCORE_RA_REGNUM
, bp_addr
);
527 /* Step 2, Make space on the stack for the args. */
528 struct_addr
= align_down (struct_addr
, 16);
529 sp
= align_down (sp
, 16);
530 for (argnum
= 0; argnum
< nargs
; argnum
++)
531 arglen
+= align_up (TYPE_LENGTH (value_type (args
[argnum
])),
533 sp
-= align_up (arglen
, 16);
535 argreg
= SCORE_BEGIN_ARG_REGNUM
;
537 /* Step 3, Check if struct return then save the struct address to
538 r4 and increase the stack_offset by 4. */
541 regcache_cooked_write_unsigned (regcache
, argreg
++, struct_addr
);
542 stack_offset
+= SCORE_REGSIZE
;
545 /* Step 4, Load arguments:
546 If arg length is too long (> 4 bytes), then split the arg and
548 for (argnum
= 0; argnum
< nargs
; argnum
++)
550 struct value
*arg
= args
[argnum
];
551 struct type
*arg_type
= check_typedef (value_type (arg
));
552 enum type_code typecode
= TYPE_CODE (arg_type
);
553 const gdb_byte
*val
= value_contents (arg
);
554 int downward_offset
= 0;
555 int odd_sized_struct_p
;
556 int arg_last_part_p
= 0;
558 arglen
= TYPE_LENGTH (arg_type
);
559 odd_sized_struct_p
= (arglen
> SCORE_REGSIZE
560 && arglen
% SCORE_REGSIZE
!= 0);
562 /* If a arg should be aligned to 8 bytes (long long or double),
563 the value should be put to even register numbers. */
564 if (score_type_needs_double_align (arg_type
))
570 /* If sizeof a block < SCORE_REGSIZE, then Score GCC will chose
571 the default "downward"/"upward" method:
577 char a; char b; char c;
578 } s = {'a', 'b', 'c'};
580 Big endian: s = {X, 'a', 'b', 'c'}
581 Little endian: s = {'a', 'b', 'c', X}
583 Where X is a hole. */
585 if (gdbarch_byte_order(gdbarch
) == BFD_ENDIAN_BIG
586 && (typecode
== TYPE_CODE_STRUCT
587 || typecode
== TYPE_CODE_UNION
)
588 && argreg
> SCORE_LAST_ARG_REGNUM
589 && arglen
< SCORE_REGSIZE
)
590 downward_offset
+= (SCORE_REGSIZE
- arglen
);
594 int partial_len
= arglen
< SCORE_REGSIZE
? arglen
: SCORE_REGSIZE
;
595 ULONGEST regval
= extract_unsigned_integer (val
, partial_len
,
598 /* The last part of a arg should shift left when
599 gdbarch_byte_order is BFD_ENDIAN_BIG. */
600 if (byte_order
== BFD_ENDIAN_BIG
601 && arg_last_part_p
== 1
602 && (typecode
== TYPE_CODE_STRUCT
603 || typecode
== TYPE_CODE_UNION
))
604 regval
<<= ((SCORE_REGSIZE
- partial_len
) * TARGET_CHAR_BIT
);
606 /* Always increase the stack_offset and save args to stack. */
607 addr
= sp
+ stack_offset
+ downward_offset
;
608 write_memory (addr
, val
, partial_len
);
610 if (argreg
<= SCORE_LAST_ARG_REGNUM
)
612 regcache_cooked_write_unsigned (regcache
, argreg
++, regval
);
613 if (arglen
> SCORE_REGSIZE
&& arglen
< SCORE_REGSIZE
* 2)
618 arglen
-= partial_len
;
619 stack_offset
+= align_up (partial_len
, SCORE_REGSIZE
);
623 /* Step 5, Save SP. */
624 regcache_cooked_write_unsigned (regcache
, SCORE_SP_REGNUM
, sp
);
630 score7_skip_prologue (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
633 int iscan
= 32, stack_sub
= 0;
636 inst_t
*inst
= score7_fetch_inst (gdbarch
, cpc
, NULL
);
639 if ((inst
->len
== 4) && !stack_sub
640 && (G_FLD (inst
->v
, 29, 25) == 0x1
641 && G_FLD (inst
->v
, 24, 20) == 0x0))
643 /* addi r0, offset */
644 stack_sub
= cpc
+ SCORE_INSTLEN
;
645 pc
= cpc
+ SCORE_INSTLEN
;
647 else if ((inst
->len
== 4)
648 && (G_FLD (inst
->v
, 29, 25) == 0x0)
649 && (G_FLD (inst
->v
, 24, 20) == 0x2)
650 && (G_FLD (inst
->v
, 19, 15) == 0x0)
651 && (G_FLD (inst
->v
, 14, 10) == 0xF)
652 && (G_FLD (inst
->v
, 9, 0) == 0x56))
655 pc
= cpc
+ SCORE_INSTLEN
;
658 else if ((inst
->len
== 2)
659 && (G_FLD (inst
->v
, 14, 12) == 0x0)
660 && (G_FLD (inst
->v
, 11, 8) == 0x2)
661 && (G_FLD (inst
->v
, 7, 4) == 0x0)
662 && (G_FLD (inst
->v
, 3, 0) == 0x3))
665 pc
= cpc
+ SCORE16_INSTLEN
;
668 else if ((inst
->len
== 2)
669 && ((G_FLD (inst
->v
, 14, 12) == 3) /* j15 form */
670 || (G_FLD (inst
->v
, 14, 12) == 4) /* b15 form */
671 || (G_FLD (inst
->v
, 14, 12) == 0x0
672 && G_FLD (inst
->v
, 3, 0) == 0x4))) /* br! */
674 else if ((inst
->len
== 4)
675 && ((G_FLD (inst
->v
, 29, 25) == 2) /* j32 form */
676 || (G_FLD (inst
->v
, 29, 25) == 4) /* b32 form */
677 || (G_FLD (inst
->v
, 29, 25) == 0x0
678 && G_FLD (inst
->v
, 6, 1) == 0x4))) /* br */
681 cpc
+= (inst
->len
== 2) ? SCORE16_INSTLEN
: SCORE_INSTLEN
;
687 score3_skip_prologue (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
690 int iscan
= 32, stack_sub
= 0;
694 = score3_adjust_pc_and_fetch_inst (&cpc
, NULL
,
695 gdbarch_byte_order (gdbarch
));
699 if (inst
->len
== 4 && !stack_sub
700 && (G_FLD (inst
->v
, 29, 25) == 0x1)
701 && (G_FLD (inst
->v
, 19, 17) == 0x0)
702 && (G_FLD (inst
->v
, 24, 20) == 0x0))
704 /* addi r0, offset */
705 stack_sub
= cpc
+ inst
->len
;
706 pc
= cpc
+ inst
->len
;
708 else if (inst
->len
== 4
709 && (G_FLD (inst
->v
, 29, 25) == 0x0)
710 && (G_FLD (inst
->v
, 24, 20) == 0x2)
711 && (G_FLD (inst
->v
, 19, 15) == 0x0)
712 && (G_FLD (inst
->v
, 14, 10) == 0xF)
713 && (G_FLD (inst
->v
, 9, 0) == 0x56))
716 pc
= cpc
+ inst
->len
;
719 else if ((inst
->len
== 2)
720 && (G_FLD (inst
->v
, 14, 10) == 0x10)
721 && (G_FLD (inst
->v
, 9, 5) == 0x2)
722 && (G_FLD (inst
->v
, 4, 0) == 0x0))
725 pc
= cpc
+ inst
->len
;
728 else if (inst
->len
== 2
729 && ((G_FLD (inst
->v
, 14, 12) == 3) /* b15 form */
730 || (G_FLD (inst
->v
, 14, 12) == 0x0
731 && G_FLD (inst
->v
, 11, 5) == 0x4))) /* br! */
733 else if (inst
->len
== 4
734 && ((G_FLD (inst
->v
, 29, 25) == 2) /* j32 form */
735 || (G_FLD (inst
->v
, 29, 25) == 4))) /* b32 form */
744 score7_in_function_epilogue_p (struct gdbarch
*gdbarch
, CORE_ADDR cur_pc
)
746 inst_t
*inst
= score7_fetch_inst (gdbarch
, cur_pc
, NULL
);
749 return 1; /* mv! r0, r2 */
750 else if (G_FLD (inst
->v
, 14, 12) == 0x2
751 && G_FLD (inst
->v
, 3, 0) == 0xa)
753 else if (G_FLD (inst
->v
, 14, 12) == 0x0
754 && G_FLD (inst
->v
, 7, 0) == 0x34)
755 return 1; /* br! r3 */
756 else if (G_FLD (inst
->v
, 29, 15) == 0x2
757 && G_FLD (inst
->v
, 6, 1) == 0x2b)
758 return 1; /* mv r0, r2 */
759 else if (G_FLD (inst
->v
, 29, 25) == 0x0
760 && G_FLD (inst
->v
, 6, 1) == 0x4
761 && G_FLD (inst
->v
, 19, 15) == 0x3)
762 return 1; /* br r3 */
768 score3_in_function_epilogue_p (struct gdbarch
*gdbarch
, CORE_ADDR cur_pc
)
770 CORE_ADDR pc
= cur_pc
;
772 = score3_adjust_pc_and_fetch_inst (&pc
, NULL
,
773 gdbarch_byte_order (gdbarch
));
776 && (G_FLD (inst
->v
, 14, 10) == 0x10)
777 && (G_FLD (inst
->v
, 9, 5) == 0x0)
778 && (G_FLD (inst
->v
, 4, 0) == 0x2))
779 return 1; /* mv! r0, r2 */
780 else if (inst
->len
== 4
781 && (G_FLD (inst
->v
, 29, 25) == 0x0)
782 && (G_FLD (inst
->v
, 24, 20) == 0x2)
783 && (G_FLD (inst
->v
, 19, 15) == 0x0)
784 && (G_FLD (inst
->v
, 14, 10) == 0xF)
785 && (G_FLD (inst
->v
, 9, 0) == 0x56))
786 return 1; /* mv r0, r2 */
787 else if (inst
->len
== 2
788 && (G_FLD (inst
->v
, 14, 12) == 0x0)
789 && (G_FLD (inst
->v
, 11, 5) == 0x2))
791 else if (inst
->len
== 2
792 && (G_FLD (inst
->v
, 14, 12) == 0x0)
793 && (G_FLD (inst
->v
, 11, 7) == 0x0)
794 && (G_FLD (inst
->v
, 6, 5) == 0x2))
795 return 1; /* rpop! */
796 else if (inst
->len
== 2
797 && (G_FLD (inst
->v
, 14, 12) == 0x0)
798 && (G_FLD (inst
->v
, 11, 5) == 0x4)
799 && (G_FLD (inst
->v
, 4, 0) == 0x3))
800 return 1; /* br! r3 */
801 else if (inst
->len
== 4
802 && (G_FLD (inst
->v
, 29, 25) == 0x0)
803 && (G_FLD (inst
->v
, 24, 20) == 0x0)
804 && (G_FLD (inst
->v
, 19, 15) == 0x3)
805 && (G_FLD (inst
->v
, 14, 10) == 0xF)
806 && (G_FLD (inst
->v
, 9, 0) == 0x8))
807 return 1; /* br r3 */
813 score7_malloc_and_get_memblock (CORE_ADDR addr
, CORE_ADDR size
)
816 char *memblock
= NULL
;
820 error (_("Error: malloc size < 0 in file:%s, line:%d!"),
827 memblock
= (char *) xmalloc (size
);
828 memset (memblock
, 0, size
);
829 ret
= target_read_memory (addr
& ~0x3, memblock
, size
);
832 error (_("Error: target_read_memory in file:%s, line:%d!"),
840 score7_free_memblock (char *memblock
)
846 score7_adjust_memblock_ptr (char **memblock
, CORE_ADDR prev_pc
,
851 /* First time call this function, do nothing. */
853 else if (cur_pc
- prev_pc
== 2 && (cur_pc
& 0x3) == 0)
855 /* First 16-bit instruction, then 32-bit instruction. */
856 *memblock
+= SCORE_INSTLEN
;
858 else if (cur_pc
- prev_pc
== 4)
860 /* Is 32-bit instruction, increase MEMBLOCK by 4. */
861 *memblock
+= SCORE_INSTLEN
;
866 score7_analyze_prologue (CORE_ADDR startaddr
, CORE_ADDR pc
,
867 struct frame_info
*this_frame
,
868 struct score_frame_cache
*this_cache
)
870 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
873 CORE_ADDR cur_pc
= startaddr
;
882 char *memblock
= NULL
;
883 char *memblock_ptr
= NULL
;
884 CORE_ADDR prev_pc
= -1;
886 /* Allocate MEMBLOCK if PC - STARTADDR > 0. */
887 memblock_ptr
= memblock
=
888 score7_malloc_and_get_memblock (startaddr
, pc
- startaddr
);
890 sp
= get_frame_register_unsigned (this_frame
, SCORE_SP_REGNUM
);
891 fp
= get_frame_register_unsigned (this_frame
, SCORE_FP_REGNUM
);
893 for (; cur_pc
< pc
; prev_pc
= cur_pc
, cur_pc
+= inst_len
)
896 if (memblock
!= NULL
)
898 /* Reading memory block from target succefully and got all
899 the instructions(from STARTADDR to PC) needed. */
900 score7_adjust_memblock_ptr (&memblock
, prev_pc
, cur_pc
);
901 inst
= score7_fetch_inst (gdbarch
, cur_pc
, memblock
);
905 /* Otherwise, we fetch 4 bytes from target, and GDB also
907 inst
= score7_fetch_inst (gdbarch
, cur_pc
, NULL
);
910 /* FIXME: make a full-power prologue analyzer. */
913 inst_len
= SCORE16_INSTLEN
;
915 if (G_FLD (inst
->v
, 14, 12) == 0x2
916 && G_FLD (inst
->v
, 3, 0) == 0xe)
921 if (G_FLD (inst
->v
, 11, 7) == 0x6
925 ra_offset
= sp_offset
;
928 else if (G_FLD (inst
->v
, 11, 7) == 0x4
932 fp_offset
= sp_offset
;
936 else if (G_FLD (inst
->v
, 14, 12) == 0x2
937 && G_FLD (inst
->v
, 3, 0) == 0xa)
942 else if (G_FLD (inst
->v
, 14, 7) == 0xc1
943 && G_FLD (inst
->v
, 2, 0) == 0x0)
946 sp_offset
+= (int) pow (2, G_FLD (inst
->v
, 6, 3));
948 else if (G_FLD (inst
->v
, 14, 7) == 0xc0
949 && G_FLD (inst
->v
, 2, 0) == 0x0)
952 sp_offset
-= (int) pow (2, G_FLD (inst
->v
, 6, 3));
957 inst_len
= SCORE_INSTLEN
;
959 if (G_FLD(inst
->v
, 29, 25) == 0x3
960 && G_FLD(inst
->v
, 2, 0) == 0x4
961 && G_FLD(inst
->v
, 19, 15) == 0)
963 /* sw rD, [r0, offset]+ */
964 sp_offset
+= SCORE_INSTLEN
;
966 if (G_FLD(inst
->v
, 24, 20) == 0x3)
969 if (ra_offset_p
== 0)
971 ra_offset
= sp_offset
;
975 else if (G_FLD(inst
->v
, 24, 20) == 0x2)
978 if (fp_offset_p
== 0)
980 fp_offset
= sp_offset
;
985 else if (G_FLD(inst
->v
, 29, 25) == 0x14
986 && G_FLD(inst
->v
, 19,15) == 0)
988 /* sw rD, [r0, offset] */
989 if (G_FLD(inst
->v
, 24, 20) == 0x3)
992 ra_offset
= sp_offset
- G_FLD(inst
->v
, 14, 0);
995 else if (G_FLD(inst
->v
, 24, 20) == 0x2)
998 fp_offset
= sp_offset
- G_FLD(inst
->v
, 14, 0);
1002 else if (G_FLD (inst
->v
, 29, 15) == 0x1c60
1003 && G_FLD (inst
->v
, 2, 0) == 0x0)
1005 /* lw r3, [r0]+, 4 */
1006 sp_offset
-= SCORE_INSTLEN
;
1009 else if (G_FLD (inst
->v
, 29, 15) == 0x1c40
1010 && G_FLD (inst
->v
, 2, 0) == 0x0)
1012 /* lw r2, [r0]+, 4 */
1013 sp_offset
-= SCORE_INSTLEN
;
1017 else if (G_FLD (inst
->v
, 29, 17) == 0x100
1018 && G_FLD (inst
->v
, 0, 0) == 0x0)
1020 /* addi r0, -offset */
1021 sp_offset
+= 65536 - G_FLD (inst
->v
, 16, 1);
1023 else if (G_FLD (inst
->v
, 29, 17) == 0x110
1024 && G_FLD (inst
->v
, 0, 0) == 0x0)
1026 /* addi r2, offset */
1027 if (pc
- cur_pc
> 4)
1029 unsigned int save_v
= inst
->v
;
1031 score7_fetch_inst (gdbarch
, cur_pc
+ SCORE_INSTLEN
, NULL
);
1032 if (inst2
->v
== 0x23)
1035 sp_offset
-= G_FLD (save_v
, 16, 1);
1043 if (ra_offset_p
== 1)
1045 if (this_cache
->saved_regs
[SCORE_PC_REGNUM
].addr
== -1)
1046 this_cache
->saved_regs
[SCORE_PC_REGNUM
].addr
=
1047 sp
+ sp_offset
- ra_offset
;
1051 this_cache
->saved_regs
[SCORE_PC_REGNUM
] =
1052 this_cache
->saved_regs
[SCORE_RA_REGNUM
];
1056 if (fp_offset_p
== 1)
1058 if (this_cache
->saved_regs
[SCORE_FP_REGNUM
].addr
== -1)
1059 this_cache
->saved_regs
[SCORE_FP_REGNUM
].addr
=
1060 sp
+ sp_offset
- fp_offset
;
1063 /* Save SP and FP. */
1064 this_cache
->base
= sp
+ sp_offset
;
1065 this_cache
->fp
= fp
;
1067 /* Don't forget to free MEMBLOCK if we allocated it. */
1068 if (memblock_ptr
!= NULL
)
1069 score7_free_memblock (memblock_ptr
);
1073 score3_analyze_prologue (CORE_ADDR startaddr
, CORE_ADDR pc
,
1074 struct frame_info
*this_frame
,
1075 struct score_frame_cache
*this_cache
)
1079 CORE_ADDR cur_pc
= startaddr
;
1080 enum bfd_endian byte_order
1081 = gdbarch_byte_order (get_frame_arch (this_frame
));
1086 int ra_offset_p
= 0;
1087 int fp_offset_p
= 0;
1090 CORE_ADDR prev_pc
= -1;
1092 sp
= get_frame_register_unsigned (this_frame
, SCORE_SP_REGNUM
);
1093 fp
= get_frame_register_unsigned (this_frame
, SCORE_FP_REGNUM
);
1095 for (; cur_pc
< pc
; prev_pc
= cur_pc
, cur_pc
+= inst_len
)
1097 inst_t
*inst
= NULL
;
1099 inst
= score3_adjust_pc_and_fetch_inst (&cur_pc
, &inst_len
, byte_order
);
1101 /* FIXME: make a full-power prologue analyzer. */
1104 if (G_FLD (inst
->v
, 14, 12) == 0x0
1105 && G_FLD (inst
->v
, 11, 7) == 0x0
1106 && G_FLD (inst
->v
, 6, 5) == 0x3)
1111 if (G_FLD (inst
->v
, 4, 0) == 0x3
1112 && ra_offset_p
== 0)
1114 /* push! r3, [r0] */
1115 ra_offset
= sp_offset
;
1118 else if (G_FLD (inst
->v
, 4, 0) == 0x2
1119 && fp_offset_p
== 0)
1121 /* push! r2, [r0] */
1122 fp_offset
= sp_offset
;
1126 else if (G_FLD (inst
->v
, 14, 12) == 0x6
1127 && G_FLD (inst
->v
, 11, 10) == 0x3)
1130 int start_r
= G_FLD (inst
->v
, 9, 5);
1131 int cnt
= G_FLD (inst
->v
, 4, 0);
1133 if ((ra_offset_p
== 0)
1134 && (start_r
<= SCORE_RA_REGNUM
)
1135 && (SCORE_RA_REGNUM
< start_r
+ cnt
))
1137 /* rpush! contains r3 */
1139 ra_offset
= sp_offset
+ 4 * (SCORE_RA_REGNUM
- start_r
) + 4;
1142 if ((fp_offset_p
== 0)
1143 && (start_r
<= SCORE_FP_REGNUM
)
1144 && (SCORE_FP_REGNUM
< start_r
+ cnt
))
1146 /* rpush! contains r2 */
1148 fp_offset
= sp_offset
+ 4 * (SCORE_FP_REGNUM
- start_r
) + 4;
1151 sp_offset
+= 4 * cnt
;
1153 else if (G_FLD (inst
->v
, 14, 12) == 0x0
1154 && G_FLD (inst
->v
, 11, 7) == 0x0
1155 && G_FLD (inst
->v
, 6, 5) == 0x2)
1160 else if (G_FLD (inst
->v
, 14, 12) == 0x6
1161 && G_FLD (inst
->v
, 11, 10) == 0x2)
1164 sp_offset
-= 4 * G_FLD (inst
->v
, 4, 0);
1166 else if (G_FLD (inst
->v
, 14, 12) == 0x5
1167 && G_FLD (inst
->v
, 11, 10) == 0x3
1168 && G_FLD (inst
->v
, 9, 6) == 0x0)
1170 /* addi! r0, -offset */
1171 int imm
= G_FLD (inst
->v
, 5, 0);
1173 imm
= -(0x3F - imm
+ 1);
1176 else if (G_FLD (inst
->v
, 14, 12) == 0x5
1177 && G_FLD (inst
->v
, 11, 10) == 0x3
1178 && G_FLD (inst
->v
, 9, 6) == 0x2)
1180 /* addi! r2, offset */
1181 if (pc
- cur_pc
>= 2)
1183 unsigned int save_v
= inst
->v
;
1186 cur_pc
+= inst
->len
;
1187 inst2
= score3_adjust_pc_and_fetch_inst (&cur_pc
, NULL
,
1191 && G_FLD (inst2
->v
, 14, 10) == 0x10
1192 && G_FLD (inst2
->v
, 9, 5) == 0x0
1193 && G_FLD (inst2
->v
, 4, 0) == 0x2)
1196 int imm
= G_FLD (inst
->v
, 5, 0);
1198 imm
= -(0x3F - imm
+ 1);
1204 else if (inst
->len
== 4)
1206 if (G_FLD (inst
->v
, 29, 25) == 0x3
1207 && G_FLD (inst
->v
, 2, 0) == 0x4
1208 && G_FLD (inst
->v
, 24, 20) == 0x3
1209 && G_FLD (inst
->v
, 19, 15) == 0x0)
1211 /* sw r3, [r0, offset]+ */
1212 sp_offset
+= inst
->len
;
1213 if (ra_offset_p
== 0)
1215 ra_offset
= sp_offset
;
1219 else if (G_FLD (inst
->v
, 29, 25) == 0x3
1220 && G_FLD (inst
->v
, 2, 0) == 0x4
1221 && G_FLD (inst
->v
, 24, 20) == 0x2
1222 && G_FLD (inst
->v
, 19, 15) == 0x0)
1224 /* sw r2, [r0, offset]+ */
1225 sp_offset
+= inst
->len
;
1226 if (fp_offset_p
== 0)
1228 fp_offset
= sp_offset
;
1232 else if (G_FLD (inst
->v
, 29, 25) == 0x7
1233 && G_FLD (inst
->v
, 2, 0) == 0x0
1234 && G_FLD (inst
->v
, 24, 20) == 0x3
1235 && G_FLD (inst
->v
, 19, 15) == 0x0)
1237 /* lw r3, [r0]+, 4 */
1238 sp_offset
-= inst
->len
;
1241 else if (G_FLD (inst
->v
, 29, 25) == 0x7
1242 && G_FLD (inst
->v
, 2, 0) == 0x0
1243 && G_FLD (inst
->v
, 24, 20) == 0x2
1244 && G_FLD (inst
->v
, 19, 15) == 0x0)
1246 /* lw r2, [r0]+, 4 */
1247 sp_offset
-= inst
->len
;
1250 else if (G_FLD (inst
->v
, 29, 25) == 0x1
1251 && G_FLD (inst
->v
, 19, 17) == 0x0
1252 && G_FLD (inst
->v
, 24, 20) == 0x0
1253 && G_FLD (inst
->v
, 0, 0) == 0x0)
1255 /* addi r0, -offset */
1256 int imm
= G_FLD (inst
->v
, 16, 1);
1258 imm
= -(0xFFFF - imm
+ 1);
1261 else if (G_FLD (inst
->v
, 29, 25) == 0x1
1262 && G_FLD (inst
->v
, 19, 17) == 0x0
1263 && G_FLD (inst
->v
, 24, 20) == 0x2
1264 && G_FLD (inst
->v
, 0, 0) == 0x0)
1266 /* addi r2, offset */
1267 if (pc
- cur_pc
>= 2)
1269 unsigned int save_v
= inst
->v
;
1272 cur_pc
+= inst
->len
;
1273 inst2
= score3_adjust_pc_and_fetch_inst (&cur_pc
, NULL
,
1277 && G_FLD (inst2
->v
, 14, 10) == 0x10
1278 && G_FLD (inst2
->v
, 9, 5) == 0x0
1279 && G_FLD (inst2
->v
, 4, 0) == 0x2)
1282 int imm
= G_FLD (inst
->v
, 16, 1);
1284 imm
= -(0xFFFF - imm
+ 1);
1293 if (ra_offset_p
== 1)
1295 if (this_cache
->saved_regs
[SCORE_PC_REGNUM
].addr
== -1)
1296 this_cache
->saved_regs
[SCORE_PC_REGNUM
].addr
=
1297 sp
+ sp_offset
- ra_offset
;
1301 this_cache
->saved_regs
[SCORE_PC_REGNUM
] =
1302 this_cache
->saved_regs
[SCORE_RA_REGNUM
];
1306 if (fp_offset_p
== 1)
1308 if (this_cache
->saved_regs
[SCORE_FP_REGNUM
].addr
== -1)
1309 this_cache
->saved_regs
[SCORE_FP_REGNUM
].addr
=
1310 sp
+ sp_offset
- fp_offset
;
1313 /* Save SP and FP. */
1314 this_cache
->base
= sp
+ sp_offset
;
1315 this_cache
->fp
= fp
;
1318 static struct score_frame_cache
*
1319 score_make_prologue_cache (struct frame_info
*this_frame
, void **this_cache
)
1321 struct score_frame_cache
*cache
;
1323 if ((*this_cache
) != NULL
)
1324 return (*this_cache
);
1326 cache
= FRAME_OBSTACK_ZALLOC (struct score_frame_cache
);
1327 (*this_cache
) = cache
;
1328 cache
->saved_regs
= trad_frame_alloc_saved_regs (this_frame
);
1330 /* Analyze the prologue. */
1332 const CORE_ADDR pc
= get_frame_pc (this_frame
);
1333 CORE_ADDR start_addr
;
1335 find_pc_partial_function (pc
, NULL
, &start_addr
, NULL
);
1336 if (start_addr
== 0)
1339 if (target_mach
== bfd_mach_score3
)
1340 score3_analyze_prologue (start_addr
, pc
, this_frame
, *this_cache
);
1342 score7_analyze_prologue (start_addr
, pc
, this_frame
, *this_cache
);
1346 trad_frame_set_value (cache
->saved_regs
, SCORE_SP_REGNUM
, cache
->base
);
1348 return (*this_cache
);
1352 score_prologue_this_id (struct frame_info
*this_frame
, void **this_cache
,
1353 struct frame_id
*this_id
)
1355 struct score_frame_cache
*info
= score_make_prologue_cache (this_frame
,
1357 (*this_id
) = frame_id_build (info
->base
, get_frame_func (this_frame
));
1360 static struct value
*
1361 score_prologue_prev_register (struct frame_info
*this_frame
,
1362 void **this_cache
, int regnum
)
1364 struct score_frame_cache
*info
= score_make_prologue_cache (this_frame
,
1366 return trad_frame_get_prev_register (this_frame
, info
->saved_regs
, regnum
);
1369 static const struct frame_unwind score_prologue_unwind
=
1372 score_prologue_this_id
,
1373 score_prologue_prev_register
,
1375 default_frame_sniffer
,
1380 score_prologue_frame_base_address (struct frame_info
*this_frame
,
1383 struct score_frame_cache
*info
=
1384 score_make_prologue_cache (this_frame
, this_cache
);
1388 static const struct frame_base score_prologue_frame_base
=
1390 &score_prologue_unwind
,
1391 score_prologue_frame_base_address
,
1392 score_prologue_frame_base_address
,
1393 score_prologue_frame_base_address
,
1396 static const struct frame_base
*
1397 score_prologue_frame_base_sniffer (struct frame_info
*this_frame
)
1399 return &score_prologue_frame_base
;
1402 /* Core file support (dirty hack)
1404 The core file MUST be generated by GNU/Linux on S+core. */
1407 score7_linux_supply_gregset(const struct regset
*regset
,
1408 struct regcache
*regcache
,
1409 int regnum
, const void *gregs_buf
, size_t len
)
1412 elf_gregset_t
*gregs
;
1414 gdb_assert (regset
!= NULL
);
1415 gdb_assert ((regcache
!= NULL
) && (gregs_buf
!= NULL
));
1417 gregs
= (elf_gregset_t
*) gregs_buf
;
1419 for (regno
= 0; regno
< 32; regno
++)
1420 if (regnum
== -1 || regnum
== regno
)
1421 regcache_raw_supply (regcache
, regno
, gregs
->regs
+ regno
);
1428 { 55, &(gregs
->cel
) }, /* CEL */
1429 { 54, &(gregs
->ceh
) }, /* CEH */
1430 { 53, &(gregs
->sr0
) }, /* sr0, i.e. cnt or COUNTER */
1431 { 52, &(gregs
->sr1
) }, /* sr1, i.e. lcr or LDCR */
1432 { 51, &(gregs
->sr1
) }, /* sr2, i.e. scr or STCR */
1434 /* Exception occured at this address, exactly the PC we want */
1435 { 49, &(gregs
->cp0_epc
) }, /* PC */
1437 { 38, &(gregs
->cp0_ema
) }, /* EMA */
1438 { 37, &(gregs
->cp0_epc
) }, /* EPC */
1439 { 34, &(gregs
->cp0_ecr
) }, /* ECR */
1440 { 33, &(gregs
->cp0_condition
) }, /* COND */
1441 { 32, &(gregs
->cp0_psr
) }, /* PSR */
1444 for (regno
= 0; regno
< sizeof(sregs
)/sizeof(sregs
[0]); regno
++)
1445 if (regnum
== -1 || regnum
== sregs
[regno
].regnum
)
1446 regcache_raw_supply (regcache
,
1447 sregs
[regno
].regnum
, sregs
[regno
].buf
);
1451 /* Return the appropriate register set from the core section identified
1452 by SECT_NAME and SECT_SIZE. */
1454 static const struct regset
*
1455 score7_linux_regset_from_core_section(struct gdbarch
*gdbarch
,
1456 const char *sect_name
, size_t sect_size
)
1458 struct gdbarch_tdep
*tdep
;
1460 gdb_assert (gdbarch
!= NULL
);
1461 gdb_assert (sect_name
!= NULL
);
1463 tdep
= gdbarch_tdep (gdbarch
);
1465 if (strcmp(sect_name
, ".reg") == 0 && sect_size
== sizeof(elf_gregset_t
))
1467 if (tdep
->gregset
== NULL
)
1468 tdep
->gregset
= regset_alloc (gdbarch
,
1469 score7_linux_supply_gregset
, NULL
);
1470 return tdep
->gregset
;
1476 static struct gdbarch
*
1477 score_gdbarch_init (struct gdbarch_info info
, struct gdbarch_list
*arches
)
1479 struct gdbarch
*gdbarch
;
1480 struct gdbarch_tdep
*tdep
;
1481 target_mach
= info
.bfd_arch_info
->mach
;
1483 arches
= gdbarch_list_lookup_by_info (arches
, &info
);
1486 return (arches
->gdbarch
);
1488 tdep
= xcalloc(1, sizeof(struct gdbarch_tdep
));
1489 gdbarch
= gdbarch_alloc (&info
, tdep
);
1491 set_gdbarch_short_bit (gdbarch
, 16);
1492 set_gdbarch_int_bit (gdbarch
, 32);
1493 set_gdbarch_float_bit (gdbarch
, 32);
1494 set_gdbarch_double_bit (gdbarch
, 64);
1495 set_gdbarch_long_double_bit (gdbarch
, 64);
1497 set_gdbarch_register_sim_regno (gdbarch
, score_register_sim_regno
);
1499 set_gdbarch_pc_regnum (gdbarch
, SCORE_PC_REGNUM
);
1500 set_gdbarch_sp_regnum (gdbarch
, SCORE_SP_REGNUM
);
1501 set_gdbarch_adjust_breakpoint_address (gdbarch
,
1502 score_adjust_breakpoint_address
);
1503 set_gdbarch_register_type (gdbarch
, score_register_type
);
1504 set_gdbarch_frame_align (gdbarch
, score_frame_align
);
1505 set_gdbarch_inner_than (gdbarch
, core_addr_lessthan
);
1506 set_gdbarch_unwind_sp (gdbarch
, score_unwind_sp
);
1507 set_gdbarch_unwind_pc (gdbarch
, score_unwind_pc
);
1508 set_gdbarch_print_insn (gdbarch
, score_print_insn
);
1510 switch (target_mach
)
1512 case bfd_mach_score7
:
1513 set_gdbarch_breakpoint_from_pc (gdbarch
, score7_breakpoint_from_pc
);
1514 set_gdbarch_skip_prologue (gdbarch
, score7_skip_prologue
);
1515 set_gdbarch_in_function_epilogue_p (gdbarch
,
1516 score7_in_function_epilogue_p
);
1517 set_gdbarch_register_name (gdbarch
, score7_register_name
);
1518 set_gdbarch_num_regs (gdbarch
, SCORE7_NUM_REGS
);
1519 /* Core file support. */
1520 set_gdbarch_regset_from_core_section (gdbarch
,
1521 score7_linux_regset_from_core_section
);
1524 case bfd_mach_score3
:
1525 set_gdbarch_breakpoint_from_pc (gdbarch
, score3_breakpoint_from_pc
);
1526 set_gdbarch_skip_prologue (gdbarch
, score3_skip_prologue
);
1527 set_gdbarch_in_function_epilogue_p (gdbarch
,
1528 score3_in_function_epilogue_p
);
1529 set_gdbarch_register_name (gdbarch
, score3_register_name
);
1530 set_gdbarch_num_regs (gdbarch
, SCORE3_NUM_REGS
);
1534 /* Watchpoint hooks. */
1535 set_gdbarch_have_nonsteppable_watchpoint (gdbarch
, 1);
1537 /* Dummy frame hooks. */
1538 set_gdbarch_return_value (gdbarch
, score_return_value
);
1539 set_gdbarch_call_dummy_location (gdbarch
, AT_ENTRY_POINT
);
1540 set_gdbarch_dummy_id (gdbarch
, score_dummy_id
);
1541 set_gdbarch_push_dummy_call (gdbarch
, score_push_dummy_call
);
1543 /* Normal frame hooks. */
1544 dwarf2_append_unwinders (gdbarch
);
1545 frame_base_append_sniffer (gdbarch
, dwarf2_frame_base_sniffer
);
1546 frame_unwind_append_unwinder (gdbarch
, &score_prologue_unwind
);
1547 frame_base_append_sniffer (gdbarch
, score_prologue_frame_base_sniffer
);
1552 extern initialize_file_ftype _initialize_score_tdep
;
1555 _initialize_score_tdep (void)
1557 gdbarch_register (bfd_arch_score
, score_gdbarch_init
, NULL
);