1 /* Target-dependent code for the S+core architecture, for GDB,
4 Copyright (C) 2006-2012 Free Software Foundation, Inc.
6 Contributed by Qinwei (qinwei@sunnorth.com.cn)
7 Contributed by Ching-Peng Lin (cplin@sunplus.com)
9 This file is part of GDB.
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 #include "gdb_assert.h"
31 #include "arch-utils.h"
35 #include "frame-unwind.h"
36 #include "frame-base.h"
37 #include "trad-frame.h"
38 #include "dwarf2-frame.h"
39 #include "score-tdep.h"
41 #define G_FLD(_i,_ms,_ls) \
42 ((unsigned)((_i) << (31 - (_ms))) >> (31 - (_ms) + (_ls)))
46 unsigned long long raw
;
50 struct score_frame_cache
54 struct trad_frame_saved_reg
*saved_regs
;
57 static int target_mach
= bfd_mach_score7
;
60 score_register_type (struct gdbarch
*gdbarch
, int regnum
)
62 gdb_assert (regnum
>= 0
63 && regnum
< ((target_mach
== bfd_mach_score7
)
64 ? SCORE7_NUM_REGS
: SCORE3_NUM_REGS
));
65 return builtin_type (gdbarch
)->builtin_uint32
;
69 score_unwind_sp (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
71 return frame_unwind_register_unsigned (next_frame
, SCORE_SP_REGNUM
);
75 score_unwind_pc (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
77 return frame_unwind_register_unsigned (next_frame
, SCORE_PC_REGNUM
);
81 score7_register_name (struct gdbarch
*gdbarch
, int regnum
)
83 const char *score_register_names
[] = {
84 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
85 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
86 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
87 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
89 "PSR", "COND", "ECR", "EXCPVEC", "CCR",
90 "EPC", "EMA", "TLBLOCK", "TLBPT", "PEADDR",
91 "TLBRPT", "PEVN", "PECTX", "LIMPFN", "LDMPFN",
92 "PREV", "DREG", "PC", "DSAVE", "COUNTER",
93 "LDCR", "STCR", "CEH", "CEL",
96 gdb_assert (regnum
>= 0 && regnum
< SCORE7_NUM_REGS
);
97 return score_register_names
[regnum
];
101 score3_register_name (struct gdbarch
*gdbarch
, int regnum
)
103 const char *score_register_names
[] = {
104 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
105 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
106 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
107 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
109 "PSR", "COND", "ECR", "EXCPVEC", "CCR",
110 "EPC", "EMA", "PREV", "DREG", "DSAVE",
111 "COUNTER", "LDCR", "STCR", "CEH", "CEL",
115 gdb_assert (regnum
>= 0 && regnum
< SCORE3_NUM_REGS
);
116 return score_register_names
[regnum
];
121 score_register_sim_regno (struct gdbarch
*gdbarch
, int regnum
)
123 gdb_assert (regnum
>= 0
124 && regnum
< ((target_mach
== bfd_mach_score7
)
125 ? SCORE7_NUM_REGS
: SCORE3_NUM_REGS
));
131 score_print_insn (bfd_vma memaddr
, struct disassemble_info
*info
)
133 if (info
->endian
== BFD_ENDIAN_BIG
)
134 return print_insn_big_score (memaddr
, info
);
136 return print_insn_little_score (memaddr
, info
);
140 score7_fetch_inst (struct gdbarch
*gdbarch
, CORE_ADDR addr
, char *memblock
)
142 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
143 static inst_t inst
= { 0, 0, 0 };
144 char buf
[SCORE_INSTLEN
] = { 0 };
148 if (target_has_execution
&& memblock
!= NULL
)
150 /* Fetch instruction from local MEMBLOCK. */
151 memcpy (buf
, memblock
, SCORE_INSTLEN
);
155 /* Fetch instruction from target. */
156 ret
= target_read_memory (addr
& ~0x3, buf
, SCORE_INSTLEN
);
159 error (_("Error: target_read_memory in file:%s, line:%d!"),
165 inst
.raw
= extract_unsigned_integer (buf
, SCORE_INSTLEN
, byte_order
);
166 inst
.len
= (inst
.raw
& 0x80008000) ? 4 : 2;
167 inst
.v
= ((inst
.raw
>> 16 & 0x7FFF) << 15) | (inst
.raw
& 0x7FFF);
168 big
= (byte_order
== BFD_ENDIAN_BIG
);
171 if (big
^ ((addr
& 0x2) == 2))
172 inst
.v
= G_FLD (inst
.v
, 29, 15);
174 inst
.v
= G_FLD (inst
.v
, 14, 0);
180 score3_adjust_pc_and_fetch_inst (CORE_ADDR
*pcptr
, int *lenptr
,
181 enum bfd_endian byte_order
)
183 static inst_t inst
= { 0, 0, 0 };
190 /* raw table 1 (column 2, 3, 4)
194 table 2 (column 1, 2, 3)
200 static const struct breakplace bk_table
[16] =
222 #define EXTRACT_LEN 2
223 CORE_ADDR adjust_pc
= *pcptr
& ~0x1;
225 gdb_byte buf
[5][EXTRACT_LEN
] =
235 unsigned int cbits
= 0;
244 for (i
= 0; i
< 5; i
++)
246 ret
= target_read_memory (adjust_pc
+ 2 * i
, buf
[i
], EXTRACT_LEN
);
252 error (_("Error: target_read_memory in file:%s, line:%d!"),
256 raw
= extract_unsigned_integer (buf
[i
], EXTRACT_LEN
, byte_order
);
257 cbits
= (cbits
<< 1) | (raw
>> 15);
264 cbits
= (cbits
>> 1) & 0x7;
270 cbits
= (cbits
>> 2) & 0x7;
271 bk_index
= cbits
+ 8;
274 gdb_assert (!((bk_table
[bk_index
].break_offset
== 0)
275 && (bk_table
[bk_index
].inst_len
== 0)));
277 inst
.len
= bk_table
[bk_index
].inst_len
;
279 i
= (bk_table
[bk_index
].break_offset
+ 4) / 2;
280 count
= inst
.len
/ 2;
281 for (; count
> 0; i
++, count
--)
283 inst
.raw
= (inst
.raw
<< 16)
284 | extract_unsigned_integer (buf
[i
], EXTRACT_LEN
, byte_order
);
290 inst
.v
= inst
.raw
& 0x7FFF;
293 inst
.v
= ((inst
.raw
>> 16 & 0x7FFF) << 15) | (inst
.raw
& 0x7FFF);
296 inst
.v
= ((inst
.raw
>> 32 & 0x7FFF) << 30)
297 | ((inst
.raw
>> 16 & 0x7FFF) << 15) | (inst
.raw
& 0x7FFF);
302 *pcptr
= adjust_pc
+ bk_table
[bk_index
].break_offset
;
304 *lenptr
= bk_table
[bk_index
].inst_len
;
311 static const gdb_byte
*
312 score7_breakpoint_from_pc (struct gdbarch
*gdbarch
, CORE_ADDR
*pcptr
,
315 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
316 gdb_byte buf
[SCORE_INSTLEN
] = { 0 };
320 if ((ret
= target_read_memory (*pcptr
& ~0x3, buf
, SCORE_INSTLEN
)) != 0)
322 error (_("Error: target_read_memory in file:%s, line:%d!"),
325 raw
= extract_unsigned_integer (buf
, SCORE_INSTLEN
, byte_order
);
327 if (byte_order
== BFD_ENDIAN_BIG
)
329 if (!(raw
& 0x80008000))
331 /* 16bits instruction. */
332 static gdb_byte big_breakpoint16
[] = { 0x60, 0x02 };
334 *lenptr
= sizeof (big_breakpoint16
);
335 return big_breakpoint16
;
339 /* 32bits instruction. */
340 static gdb_byte big_breakpoint32
[] = { 0x80, 0x00, 0x80, 0x06 };
342 *lenptr
= sizeof (big_breakpoint32
);
343 return big_breakpoint32
;
348 if (!(raw
& 0x80008000))
350 /* 16bits instruction. */
351 static gdb_byte little_breakpoint16
[] = { 0x02, 0x60 };
353 *lenptr
= sizeof (little_breakpoint16
);
354 return little_breakpoint16
;
358 /* 32bits instruction. */
359 static gdb_byte little_breakpoint32
[] = { 0x06, 0x80, 0x00, 0x80 };
361 *lenptr
= sizeof (little_breakpoint32
);
362 return little_breakpoint32
;
367 static const gdb_byte
*
368 score3_breakpoint_from_pc (struct gdbarch
*gdbarch
, CORE_ADDR
*pcptr
,
371 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
372 CORE_ADDR adjust_pc
= *pcptr
;
374 static gdb_byte score_break_insns
[6][6] = {
375 /* The following three instructions are big endian. */
377 { 0x80, 0x00, 0x00, 0x06 },
378 { 0x80, 0x00, 0x80, 0x00, 0x00, 0x00 },
379 /* The following three instructions are little endian. */
381 { 0x00, 0x80, 0x06, 0x00 },
382 { 0x00, 0x80, 0x00, 0x80, 0x00, 0x00 }};
387 score3_adjust_pc_and_fetch_inst (&adjust_pc
, &len
, byte_order
);
389 index
= ((byte_order
== BFD_ENDIAN_BIG
) ? 0 : 3) + (len
/ 2 - 1);
390 p
= score_break_insns
[index
];
399 score_adjust_breakpoint_address (struct gdbarch
*gdbarch
, CORE_ADDR bpaddr
)
401 CORE_ADDR adjust_pc
= bpaddr
;
403 if (target_mach
== bfd_mach_score3
)
404 score3_adjust_pc_and_fetch_inst (&adjust_pc
, NULL
,
405 gdbarch_byte_order (gdbarch
));
407 adjust_pc
= align_down (adjust_pc
, 2);
413 score_frame_align (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
415 return align_down (addr
, 16);
419 score_xfer_register (struct regcache
*regcache
, int regnum
, int length
,
420 enum bfd_endian endian
, gdb_byte
*readbuf
,
421 const gdb_byte
*writebuf
, int buf_offset
)
424 gdb_assert (regnum
>= 0
425 && regnum
< ((target_mach
== bfd_mach_score7
)
426 ? SCORE7_NUM_REGS
: SCORE3_NUM_REGS
));
431 reg_offset
= SCORE_REGSIZE
- length
;
433 case BFD_ENDIAN_LITTLE
:
436 case BFD_ENDIAN_UNKNOWN
:
440 error (_("Error: score_xfer_register in file:%s, line:%d!"),
445 regcache_cooked_read_part (regcache
, regnum
, reg_offset
, length
,
446 readbuf
+ buf_offset
);
447 if (writebuf
!= NULL
)
448 regcache_cooked_write_part (regcache
, regnum
, reg_offset
, length
,
449 writebuf
+ buf_offset
);
452 static enum return_value_convention
453 score_return_value (struct gdbarch
*gdbarch
, struct type
*func_type
,
454 struct type
*type
, struct regcache
*regcache
,
455 gdb_byte
* readbuf
, const gdb_byte
* writebuf
)
457 if (TYPE_CODE (type
) == TYPE_CODE_STRUCT
458 || TYPE_CODE (type
) == TYPE_CODE_UNION
459 || TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
460 return RETURN_VALUE_STRUCT_CONVENTION
;
465 for (offset
= 0, regnum
= SCORE_A0_REGNUM
;
466 offset
< TYPE_LENGTH (type
);
467 offset
+= SCORE_REGSIZE
, regnum
++)
469 int xfer
= SCORE_REGSIZE
;
471 if (offset
+ xfer
> TYPE_LENGTH (type
))
472 xfer
= TYPE_LENGTH (type
) - offset
;
473 score_xfer_register (regcache
, regnum
, xfer
,
474 gdbarch_byte_order(gdbarch
),
475 readbuf
, writebuf
, offset
);
477 return RETURN_VALUE_REGISTER_CONVENTION
;
481 static struct frame_id
482 score_dummy_id (struct gdbarch
*gdbarch
, struct frame_info
*this_frame
)
484 return frame_id_build (get_frame_register_unsigned (this_frame
,
486 get_frame_pc (this_frame
));
490 score_type_needs_double_align (struct type
*type
)
492 enum type_code typecode
= TYPE_CODE (type
);
494 if ((typecode
== TYPE_CODE_INT
&& TYPE_LENGTH (type
) == 8)
495 || (typecode
== TYPE_CODE_FLT
&& TYPE_LENGTH (type
) == 8))
497 else if (typecode
== TYPE_CODE_STRUCT
|| typecode
== TYPE_CODE_UNION
)
501 n
= TYPE_NFIELDS (type
);
502 for (i
= 0; i
< n
; i
++)
503 if (score_type_needs_double_align (TYPE_FIELD_TYPE (type
, i
)))
511 score_push_dummy_call (struct gdbarch
*gdbarch
, struct value
*function
,
512 struct regcache
*regcache
, CORE_ADDR bp_addr
,
513 int nargs
, struct value
**args
, CORE_ADDR sp
,
514 int struct_return
, CORE_ADDR struct_addr
)
516 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
520 CORE_ADDR stack_offset
= 0;
523 /* Step 1, Save RA. */
524 regcache_cooked_write_unsigned (regcache
, SCORE_RA_REGNUM
, bp_addr
);
526 /* Step 2, Make space on the stack for the args. */
527 struct_addr
= align_down (struct_addr
, 16);
528 sp
= align_down (sp
, 16);
529 for (argnum
= 0; argnum
< nargs
; argnum
++)
530 arglen
+= align_up (TYPE_LENGTH (value_type (args
[argnum
])),
532 sp
-= align_up (arglen
, 16);
534 argreg
= SCORE_BEGIN_ARG_REGNUM
;
536 /* Step 3, Check if struct return then save the struct address to
537 r4 and increase the stack_offset by 4. */
540 regcache_cooked_write_unsigned (regcache
, argreg
++, struct_addr
);
541 stack_offset
+= SCORE_REGSIZE
;
544 /* Step 4, Load arguments:
545 If arg length is too long (> 4 bytes), then split the arg and
547 for (argnum
= 0; argnum
< nargs
; argnum
++)
549 struct value
*arg
= args
[argnum
];
550 struct type
*arg_type
= check_typedef (value_type (arg
));
551 enum type_code typecode
= TYPE_CODE (arg_type
);
552 const gdb_byte
*val
= value_contents (arg
);
553 int downward_offset
= 0;
554 int odd_sized_struct_p
;
555 int arg_last_part_p
= 0;
557 arglen
= TYPE_LENGTH (arg_type
);
558 odd_sized_struct_p
= (arglen
> SCORE_REGSIZE
559 && arglen
% SCORE_REGSIZE
!= 0);
561 /* If a arg should be aligned to 8 bytes (long long or double),
562 the value should be put to even register numbers. */
563 if (score_type_needs_double_align (arg_type
))
569 /* If sizeof a block < SCORE_REGSIZE, then Score GCC will chose
570 the default "downward"/"upward" method:
576 char a; char b; char c;
577 } s = {'a', 'b', 'c'};
579 Big endian: s = {X, 'a', 'b', 'c'}
580 Little endian: s = {'a', 'b', 'c', X}
582 Where X is a hole. */
584 if (gdbarch_byte_order(gdbarch
) == BFD_ENDIAN_BIG
585 && (typecode
== TYPE_CODE_STRUCT
586 || typecode
== TYPE_CODE_UNION
)
587 && argreg
> SCORE_LAST_ARG_REGNUM
588 && arglen
< SCORE_REGSIZE
)
589 downward_offset
+= (SCORE_REGSIZE
- arglen
);
593 int partial_len
= arglen
< SCORE_REGSIZE
? arglen
: SCORE_REGSIZE
;
594 ULONGEST regval
= extract_unsigned_integer (val
, partial_len
,
597 /* The last part of a arg should shift left when
598 gdbarch_byte_order is BFD_ENDIAN_BIG. */
599 if (byte_order
== BFD_ENDIAN_BIG
600 && arg_last_part_p
== 1
601 && (typecode
== TYPE_CODE_STRUCT
602 || typecode
== TYPE_CODE_UNION
))
603 regval
<<= ((SCORE_REGSIZE
- partial_len
) * TARGET_CHAR_BIT
);
605 /* Always increase the stack_offset and save args to stack. */
606 addr
= sp
+ stack_offset
+ downward_offset
;
607 write_memory (addr
, val
, partial_len
);
609 if (argreg
<= SCORE_LAST_ARG_REGNUM
)
611 regcache_cooked_write_unsigned (regcache
, argreg
++, regval
);
612 if (arglen
> SCORE_REGSIZE
&& arglen
< SCORE_REGSIZE
* 2)
617 arglen
-= partial_len
;
618 stack_offset
+= align_up (partial_len
, SCORE_REGSIZE
);
622 /* Step 5, Save SP. */
623 regcache_cooked_write_unsigned (regcache
, SCORE_SP_REGNUM
, sp
);
629 score7_skip_prologue (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
632 int iscan
= 32, stack_sub
= 0;
635 inst_t
*inst
= score7_fetch_inst (gdbarch
, cpc
, NULL
);
638 if ((inst
->len
== 4) && !stack_sub
639 && (G_FLD (inst
->v
, 29, 25) == 0x1
640 && G_FLD (inst
->v
, 24, 20) == 0x0))
642 /* addi r0, offset */
643 stack_sub
= cpc
+ SCORE_INSTLEN
;
644 pc
= cpc
+ SCORE_INSTLEN
;
646 else if ((inst
->len
== 4)
647 && (G_FLD (inst
->v
, 29, 25) == 0x0)
648 && (G_FLD (inst
->v
, 24, 20) == 0x2)
649 && (G_FLD (inst
->v
, 19, 15) == 0x0)
650 && (G_FLD (inst
->v
, 14, 10) == 0xF)
651 && (G_FLD (inst
->v
, 9, 0) == 0x56))
654 pc
= cpc
+ SCORE_INSTLEN
;
657 else if ((inst
->len
== 2)
658 && (G_FLD (inst
->v
, 14, 12) == 0x0)
659 && (G_FLD (inst
->v
, 11, 8) == 0x2)
660 && (G_FLD (inst
->v
, 7, 4) == 0x0)
661 && (G_FLD (inst
->v
, 3, 0) == 0x3))
664 pc
= cpc
+ SCORE16_INSTLEN
;
667 else if ((inst
->len
== 2)
668 && ((G_FLD (inst
->v
, 14, 12) == 3) /* j15 form */
669 || (G_FLD (inst
->v
, 14, 12) == 4) /* b15 form */
670 || (G_FLD (inst
->v
, 14, 12) == 0x0
671 && G_FLD (inst
->v
, 3, 0) == 0x4))) /* br! */
673 else if ((inst
->len
== 4)
674 && ((G_FLD (inst
->v
, 29, 25) == 2) /* j32 form */
675 || (G_FLD (inst
->v
, 29, 25) == 4) /* b32 form */
676 || (G_FLD (inst
->v
, 29, 25) == 0x0
677 && G_FLD (inst
->v
, 6, 1) == 0x4))) /* br */
680 cpc
+= (inst
->len
== 2) ? SCORE16_INSTLEN
: SCORE_INSTLEN
;
686 score3_skip_prologue (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
689 int iscan
= 32, stack_sub
= 0;
693 = score3_adjust_pc_and_fetch_inst (&cpc
, NULL
,
694 gdbarch_byte_order (gdbarch
));
698 if (inst
->len
== 4 && !stack_sub
699 && (G_FLD (inst
->v
, 29, 25) == 0x1)
700 && (G_FLD (inst
->v
, 19, 17) == 0x0)
701 && (G_FLD (inst
->v
, 24, 20) == 0x0))
703 /* addi r0, offset */
704 stack_sub
= cpc
+ inst
->len
;
705 pc
= cpc
+ inst
->len
;
707 else if (inst
->len
== 4
708 && (G_FLD (inst
->v
, 29, 25) == 0x0)
709 && (G_FLD (inst
->v
, 24, 20) == 0x2)
710 && (G_FLD (inst
->v
, 19, 15) == 0x0)
711 && (G_FLD (inst
->v
, 14, 10) == 0xF)
712 && (G_FLD (inst
->v
, 9, 0) == 0x56))
715 pc
= cpc
+ inst
->len
;
718 else if ((inst
->len
== 2)
719 && (G_FLD (inst
->v
, 14, 10) == 0x10)
720 && (G_FLD (inst
->v
, 9, 5) == 0x2)
721 && (G_FLD (inst
->v
, 4, 0) == 0x0))
724 pc
= cpc
+ inst
->len
;
727 else if (inst
->len
== 2
728 && ((G_FLD (inst
->v
, 14, 12) == 3) /* b15 form */
729 || (G_FLD (inst
->v
, 14, 12) == 0x0
730 && G_FLD (inst
->v
, 11, 5) == 0x4))) /* br! */
732 else if (inst
->len
== 4
733 && ((G_FLD (inst
->v
, 29, 25) == 2) /* j32 form */
734 || (G_FLD (inst
->v
, 29, 25) == 4))) /* b32 form */
743 score7_in_function_epilogue_p (struct gdbarch
*gdbarch
, CORE_ADDR cur_pc
)
745 inst_t
*inst
= score7_fetch_inst (gdbarch
, cur_pc
, NULL
);
748 return 1; /* mv! r0, r2 */
749 else if (G_FLD (inst
->v
, 14, 12) == 0x2
750 && G_FLD (inst
->v
, 3, 0) == 0xa)
752 else if (G_FLD (inst
->v
, 14, 12) == 0x0
753 && G_FLD (inst
->v
, 7, 0) == 0x34)
754 return 1; /* br! r3 */
755 else if (G_FLD (inst
->v
, 29, 15) == 0x2
756 && G_FLD (inst
->v
, 6, 1) == 0x2b)
757 return 1; /* mv r0, r2 */
758 else if (G_FLD (inst
->v
, 29, 25) == 0x0
759 && G_FLD (inst
->v
, 6, 1) == 0x4
760 && G_FLD (inst
->v
, 19, 15) == 0x3)
761 return 1; /* br r3 */
767 score3_in_function_epilogue_p (struct gdbarch
*gdbarch
, CORE_ADDR cur_pc
)
769 CORE_ADDR pc
= cur_pc
;
771 = score3_adjust_pc_and_fetch_inst (&pc
, NULL
,
772 gdbarch_byte_order (gdbarch
));
775 && (G_FLD (inst
->v
, 14, 10) == 0x10)
776 && (G_FLD (inst
->v
, 9, 5) == 0x0)
777 && (G_FLD (inst
->v
, 4, 0) == 0x2))
778 return 1; /* mv! r0, r2 */
779 else if (inst
->len
== 4
780 && (G_FLD (inst
->v
, 29, 25) == 0x0)
781 && (G_FLD (inst
->v
, 24, 20) == 0x2)
782 && (G_FLD (inst
->v
, 19, 15) == 0x0)
783 && (G_FLD (inst
->v
, 14, 10) == 0xF)
784 && (G_FLD (inst
->v
, 9, 0) == 0x56))
785 return 1; /* mv r0, r2 */
786 else if (inst
->len
== 2
787 && (G_FLD (inst
->v
, 14, 12) == 0x0)
788 && (G_FLD (inst
->v
, 11, 5) == 0x2))
790 else if (inst
->len
== 2
791 && (G_FLD (inst
->v
, 14, 12) == 0x0)
792 && (G_FLD (inst
->v
, 11, 7) == 0x0)
793 && (G_FLD (inst
->v
, 6, 5) == 0x2))
794 return 1; /* rpop! */
795 else if (inst
->len
== 2
796 && (G_FLD (inst
->v
, 14, 12) == 0x0)
797 && (G_FLD (inst
->v
, 11, 5) == 0x4)
798 && (G_FLD (inst
->v
, 4, 0) == 0x3))
799 return 1; /* br! r3 */
800 else if (inst
->len
== 4
801 && (G_FLD (inst
->v
, 29, 25) == 0x0)
802 && (G_FLD (inst
->v
, 24, 20) == 0x0)
803 && (G_FLD (inst
->v
, 19, 15) == 0x3)
804 && (G_FLD (inst
->v
, 14, 10) == 0xF)
805 && (G_FLD (inst
->v
, 9, 0) == 0x8))
806 return 1; /* br r3 */
812 score7_malloc_and_get_memblock (CORE_ADDR addr
, CORE_ADDR size
)
815 char *memblock
= NULL
;
819 error (_("Error: malloc size < 0 in file:%s, line:%d!"),
826 memblock
= (char *) xmalloc (size
);
827 memset (memblock
, 0, size
);
828 ret
= target_read_memory (addr
& ~0x3, memblock
, size
);
831 error (_("Error: target_read_memory in file:%s, line:%d!"),
839 score7_free_memblock (char *memblock
)
845 score7_adjust_memblock_ptr (char **memblock
, CORE_ADDR prev_pc
,
850 /* First time call this function, do nothing. */
852 else if (cur_pc
- prev_pc
== 2 && (cur_pc
& 0x3) == 0)
854 /* First 16-bit instruction, then 32-bit instruction. */
855 *memblock
+= SCORE_INSTLEN
;
857 else if (cur_pc
- prev_pc
== 4)
859 /* Is 32-bit instruction, increase MEMBLOCK by 4. */
860 *memblock
+= SCORE_INSTLEN
;
865 score7_analyze_prologue (CORE_ADDR startaddr
, CORE_ADDR pc
,
866 struct frame_info
*this_frame
,
867 struct score_frame_cache
*this_cache
)
869 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
872 CORE_ADDR cur_pc
= startaddr
;
881 char *memblock
= NULL
;
882 char *memblock_ptr
= NULL
;
883 CORE_ADDR prev_pc
= -1;
885 /* Allocate MEMBLOCK if PC - STARTADDR > 0. */
886 memblock_ptr
= memblock
=
887 score7_malloc_and_get_memblock (startaddr
, pc
- startaddr
);
889 sp
= get_frame_register_unsigned (this_frame
, SCORE_SP_REGNUM
);
890 fp
= get_frame_register_unsigned (this_frame
, SCORE_FP_REGNUM
);
892 for (; cur_pc
< pc
; prev_pc
= cur_pc
, cur_pc
+= inst_len
)
895 if (memblock
!= NULL
)
897 /* Reading memory block from target succefully and got all
898 the instructions(from STARTADDR to PC) needed. */
899 score7_adjust_memblock_ptr (&memblock
, prev_pc
, cur_pc
);
900 inst
= score7_fetch_inst (gdbarch
, cur_pc
, memblock
);
904 /* Otherwise, we fetch 4 bytes from target, and GDB also
906 inst
= score7_fetch_inst (gdbarch
, cur_pc
, NULL
);
909 /* FIXME: make a full-power prologue analyzer. */
912 inst_len
= SCORE16_INSTLEN
;
914 if (G_FLD (inst
->v
, 14, 12) == 0x2
915 && G_FLD (inst
->v
, 3, 0) == 0xe)
920 if (G_FLD (inst
->v
, 11, 7) == 0x6
924 ra_offset
= sp_offset
;
927 else if (G_FLD (inst
->v
, 11, 7) == 0x4
931 fp_offset
= sp_offset
;
935 else if (G_FLD (inst
->v
, 14, 12) == 0x2
936 && G_FLD (inst
->v
, 3, 0) == 0xa)
941 else if (G_FLD (inst
->v
, 14, 7) == 0xc1
942 && G_FLD (inst
->v
, 2, 0) == 0x0)
945 sp_offset
+= (int) pow (2, G_FLD (inst
->v
, 6, 3));
947 else if (G_FLD (inst
->v
, 14, 7) == 0xc0
948 && G_FLD (inst
->v
, 2, 0) == 0x0)
951 sp_offset
-= (int) pow (2, G_FLD (inst
->v
, 6, 3));
956 inst_len
= SCORE_INSTLEN
;
958 if (G_FLD(inst
->v
, 29, 25) == 0x3
959 && G_FLD(inst
->v
, 2, 0) == 0x4
960 && G_FLD(inst
->v
, 19, 15) == 0)
962 /* sw rD, [r0, offset]+ */
963 sp_offset
+= SCORE_INSTLEN
;
965 if (G_FLD(inst
->v
, 24, 20) == 0x3)
968 if (ra_offset_p
== 0)
970 ra_offset
= sp_offset
;
974 else if (G_FLD(inst
->v
, 24, 20) == 0x2)
977 if (fp_offset_p
== 0)
979 fp_offset
= sp_offset
;
984 else if (G_FLD(inst
->v
, 29, 25) == 0x14
985 && G_FLD(inst
->v
, 19,15) == 0)
987 /* sw rD, [r0, offset] */
988 if (G_FLD(inst
->v
, 24, 20) == 0x3)
991 ra_offset
= sp_offset
- G_FLD(inst
->v
, 14, 0);
994 else if (G_FLD(inst
->v
, 24, 20) == 0x2)
997 fp_offset
= sp_offset
- G_FLD(inst
->v
, 14, 0);
1001 else if (G_FLD (inst
->v
, 29, 15) == 0x1c60
1002 && G_FLD (inst
->v
, 2, 0) == 0x0)
1004 /* lw r3, [r0]+, 4 */
1005 sp_offset
-= SCORE_INSTLEN
;
1008 else if (G_FLD (inst
->v
, 29, 15) == 0x1c40
1009 && G_FLD (inst
->v
, 2, 0) == 0x0)
1011 /* lw r2, [r0]+, 4 */
1012 sp_offset
-= SCORE_INSTLEN
;
1016 else if (G_FLD (inst
->v
, 29, 17) == 0x100
1017 && G_FLD (inst
->v
, 0, 0) == 0x0)
1019 /* addi r0, -offset */
1020 sp_offset
+= 65536 - G_FLD (inst
->v
, 16, 1);
1022 else if (G_FLD (inst
->v
, 29, 17) == 0x110
1023 && G_FLD (inst
->v
, 0, 0) == 0x0)
1025 /* addi r2, offset */
1026 if (pc
- cur_pc
> 4)
1028 unsigned int save_v
= inst
->v
;
1030 score7_fetch_inst (gdbarch
, cur_pc
+ SCORE_INSTLEN
, NULL
);
1031 if (inst2
->v
== 0x23)
1034 sp_offset
-= G_FLD (save_v
, 16, 1);
1042 if (ra_offset_p
== 1)
1044 if (this_cache
->saved_regs
[SCORE_PC_REGNUM
].addr
== -1)
1045 this_cache
->saved_regs
[SCORE_PC_REGNUM
].addr
=
1046 sp
+ sp_offset
- ra_offset
;
1050 this_cache
->saved_regs
[SCORE_PC_REGNUM
] =
1051 this_cache
->saved_regs
[SCORE_RA_REGNUM
];
1055 if (fp_offset_p
== 1)
1057 if (this_cache
->saved_regs
[SCORE_FP_REGNUM
].addr
== -1)
1058 this_cache
->saved_regs
[SCORE_FP_REGNUM
].addr
=
1059 sp
+ sp_offset
- fp_offset
;
1062 /* Save SP and FP. */
1063 this_cache
->base
= sp
+ sp_offset
;
1064 this_cache
->fp
= fp
;
1066 /* Don't forget to free MEMBLOCK if we allocated it. */
1067 if (memblock_ptr
!= NULL
)
1068 score7_free_memblock (memblock_ptr
);
1072 score3_analyze_prologue (CORE_ADDR startaddr
, CORE_ADDR pc
,
1073 struct frame_info
*this_frame
,
1074 struct score_frame_cache
*this_cache
)
1078 CORE_ADDR cur_pc
= startaddr
;
1079 enum bfd_endian byte_order
1080 = gdbarch_byte_order (get_frame_arch (this_frame
));
1085 int ra_offset_p
= 0;
1086 int fp_offset_p
= 0;
1089 CORE_ADDR prev_pc
= -1;
1091 sp
= get_frame_register_unsigned (this_frame
, SCORE_SP_REGNUM
);
1092 fp
= get_frame_register_unsigned (this_frame
, SCORE_FP_REGNUM
);
1094 for (; cur_pc
< pc
; prev_pc
= cur_pc
, cur_pc
+= inst_len
)
1096 inst_t
*inst
= NULL
;
1098 inst
= score3_adjust_pc_and_fetch_inst (&cur_pc
, &inst_len
, byte_order
);
1100 /* FIXME: make a full-power prologue analyzer. */
1103 if (G_FLD (inst
->v
, 14, 12) == 0x0
1104 && G_FLD (inst
->v
, 11, 7) == 0x0
1105 && G_FLD (inst
->v
, 6, 5) == 0x3)
1110 if (G_FLD (inst
->v
, 4, 0) == 0x3
1111 && ra_offset_p
== 0)
1113 /* push! r3, [r0] */
1114 ra_offset
= sp_offset
;
1117 else if (G_FLD (inst
->v
, 4, 0) == 0x2
1118 && fp_offset_p
== 0)
1120 /* push! r2, [r0] */
1121 fp_offset
= sp_offset
;
1125 else if (G_FLD (inst
->v
, 14, 12) == 0x6
1126 && G_FLD (inst
->v
, 11, 10) == 0x3)
1129 int start_r
= G_FLD (inst
->v
, 9, 5);
1130 int cnt
= G_FLD (inst
->v
, 4, 0);
1132 if ((ra_offset_p
== 0)
1133 && (start_r
<= SCORE_RA_REGNUM
)
1134 && (SCORE_RA_REGNUM
< start_r
+ cnt
))
1136 /* rpush! contains r3 */
1138 ra_offset
= sp_offset
+ 4 * (SCORE_RA_REGNUM
- start_r
) + 4;
1141 if ((fp_offset_p
== 0)
1142 && (start_r
<= SCORE_FP_REGNUM
)
1143 && (SCORE_FP_REGNUM
< start_r
+ cnt
))
1145 /* rpush! contains r2 */
1147 fp_offset
= sp_offset
+ 4 * (SCORE_FP_REGNUM
- start_r
) + 4;
1150 sp_offset
+= 4 * cnt
;
1152 else if (G_FLD (inst
->v
, 14, 12) == 0x0
1153 && G_FLD (inst
->v
, 11, 7) == 0x0
1154 && G_FLD (inst
->v
, 6, 5) == 0x2)
1159 else if (G_FLD (inst
->v
, 14, 12) == 0x6
1160 && G_FLD (inst
->v
, 11, 10) == 0x2)
1163 sp_offset
-= 4 * G_FLD (inst
->v
, 4, 0);
1165 else if (G_FLD (inst
->v
, 14, 12) == 0x5
1166 && G_FLD (inst
->v
, 11, 10) == 0x3
1167 && G_FLD (inst
->v
, 9, 6) == 0x0)
1169 /* addi! r0, -offset */
1170 int imm
= G_FLD (inst
->v
, 5, 0);
1172 imm
= -(0x3F - imm
+ 1);
1175 else if (G_FLD (inst
->v
, 14, 12) == 0x5
1176 && G_FLD (inst
->v
, 11, 10) == 0x3
1177 && G_FLD (inst
->v
, 9, 6) == 0x2)
1179 /* addi! r2, offset */
1180 if (pc
- cur_pc
>= 2)
1182 unsigned int save_v
= inst
->v
;
1185 cur_pc
+= inst
->len
;
1186 inst2
= score3_adjust_pc_and_fetch_inst (&cur_pc
, NULL
,
1190 && G_FLD (inst2
->v
, 14, 10) == 0x10
1191 && G_FLD (inst2
->v
, 9, 5) == 0x0
1192 && G_FLD (inst2
->v
, 4, 0) == 0x2)
1195 int imm
= G_FLD (inst
->v
, 5, 0);
1197 imm
= -(0x3F - imm
+ 1);
1203 else if (inst
->len
== 4)
1205 if (G_FLD (inst
->v
, 29, 25) == 0x3
1206 && G_FLD (inst
->v
, 2, 0) == 0x4
1207 && G_FLD (inst
->v
, 24, 20) == 0x3
1208 && G_FLD (inst
->v
, 19, 15) == 0x0)
1210 /* sw r3, [r0, offset]+ */
1211 sp_offset
+= inst
->len
;
1212 if (ra_offset_p
== 0)
1214 ra_offset
= sp_offset
;
1218 else if (G_FLD (inst
->v
, 29, 25) == 0x3
1219 && G_FLD (inst
->v
, 2, 0) == 0x4
1220 && G_FLD (inst
->v
, 24, 20) == 0x2
1221 && G_FLD (inst
->v
, 19, 15) == 0x0)
1223 /* sw r2, [r0, offset]+ */
1224 sp_offset
+= inst
->len
;
1225 if (fp_offset_p
== 0)
1227 fp_offset
= sp_offset
;
1231 else if (G_FLD (inst
->v
, 29, 25) == 0x7
1232 && G_FLD (inst
->v
, 2, 0) == 0x0
1233 && G_FLD (inst
->v
, 24, 20) == 0x3
1234 && G_FLD (inst
->v
, 19, 15) == 0x0)
1236 /* lw r3, [r0]+, 4 */
1237 sp_offset
-= inst
->len
;
1240 else if (G_FLD (inst
->v
, 29, 25) == 0x7
1241 && G_FLD (inst
->v
, 2, 0) == 0x0
1242 && G_FLD (inst
->v
, 24, 20) == 0x2
1243 && G_FLD (inst
->v
, 19, 15) == 0x0)
1245 /* lw r2, [r0]+, 4 */
1246 sp_offset
-= inst
->len
;
1249 else if (G_FLD (inst
->v
, 29, 25) == 0x1
1250 && G_FLD (inst
->v
, 19, 17) == 0x0
1251 && G_FLD (inst
->v
, 24, 20) == 0x0
1252 && G_FLD (inst
->v
, 0, 0) == 0x0)
1254 /* addi r0, -offset */
1255 int imm
= G_FLD (inst
->v
, 16, 1);
1257 imm
= -(0xFFFF - imm
+ 1);
1260 else if (G_FLD (inst
->v
, 29, 25) == 0x1
1261 && G_FLD (inst
->v
, 19, 17) == 0x0
1262 && G_FLD (inst
->v
, 24, 20) == 0x2
1263 && G_FLD (inst
->v
, 0, 0) == 0x0)
1265 /* addi r2, offset */
1266 if (pc
- cur_pc
>= 2)
1268 unsigned int save_v
= inst
->v
;
1271 cur_pc
+= inst
->len
;
1272 inst2
= score3_adjust_pc_and_fetch_inst (&cur_pc
, NULL
,
1276 && G_FLD (inst2
->v
, 14, 10) == 0x10
1277 && G_FLD (inst2
->v
, 9, 5) == 0x0
1278 && G_FLD (inst2
->v
, 4, 0) == 0x2)
1281 int imm
= G_FLD (inst
->v
, 16, 1);
1283 imm
= -(0xFFFF - imm
+ 1);
1292 if (ra_offset_p
== 1)
1294 if (this_cache
->saved_regs
[SCORE_PC_REGNUM
].addr
== -1)
1295 this_cache
->saved_regs
[SCORE_PC_REGNUM
].addr
=
1296 sp
+ sp_offset
- ra_offset
;
1300 this_cache
->saved_regs
[SCORE_PC_REGNUM
] =
1301 this_cache
->saved_regs
[SCORE_RA_REGNUM
];
1305 if (fp_offset_p
== 1)
1307 if (this_cache
->saved_regs
[SCORE_FP_REGNUM
].addr
== -1)
1308 this_cache
->saved_regs
[SCORE_FP_REGNUM
].addr
=
1309 sp
+ sp_offset
- fp_offset
;
1312 /* Save SP and FP. */
1313 this_cache
->base
= sp
+ sp_offset
;
1314 this_cache
->fp
= fp
;
1317 static struct score_frame_cache
*
1318 score_make_prologue_cache (struct frame_info
*this_frame
, void **this_cache
)
1320 struct score_frame_cache
*cache
;
1322 if ((*this_cache
) != NULL
)
1323 return (*this_cache
);
1325 cache
= FRAME_OBSTACK_ZALLOC (struct score_frame_cache
);
1326 (*this_cache
) = cache
;
1327 cache
->saved_regs
= trad_frame_alloc_saved_regs (this_frame
);
1329 /* Analyze the prologue. */
1331 const CORE_ADDR pc
= get_frame_pc (this_frame
);
1332 CORE_ADDR start_addr
;
1334 find_pc_partial_function (pc
, NULL
, &start_addr
, NULL
);
1335 if (start_addr
== 0)
1338 if (target_mach
== bfd_mach_score3
)
1339 score3_analyze_prologue (start_addr
, pc
, this_frame
, *this_cache
);
1341 score7_analyze_prologue (start_addr
, pc
, this_frame
, *this_cache
);
1345 trad_frame_set_value (cache
->saved_regs
, SCORE_SP_REGNUM
, cache
->base
);
1347 return (*this_cache
);
1351 score_prologue_this_id (struct frame_info
*this_frame
, void **this_cache
,
1352 struct frame_id
*this_id
)
1354 struct score_frame_cache
*info
= score_make_prologue_cache (this_frame
,
1356 (*this_id
) = frame_id_build (info
->base
, get_frame_func (this_frame
));
1359 static struct value
*
1360 score_prologue_prev_register (struct frame_info
*this_frame
,
1361 void **this_cache
, int regnum
)
1363 struct score_frame_cache
*info
= score_make_prologue_cache (this_frame
,
1365 return trad_frame_get_prev_register (this_frame
, info
->saved_regs
, regnum
);
1368 static const struct frame_unwind score_prologue_unwind
=
1371 default_frame_unwind_stop_reason
,
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
);