1 /* Target-machine dependent code for Renesas H8/300, for GDB.
3 Copyright (C) 1988-2014 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 Contributed by Steve Chamberlain
27 #include "arch-utils.h"
31 #include "gdb_assert.h"
33 #include "dwarf2-frame.h"
34 #include "frame-base.h"
35 #include "frame-unwind.h"
39 E_R0_REGNUM, E_ER0_REGNUM = E_R0_REGNUM, E_ARG0_REGNUM = E_R0_REGNUM,
40 E_RET0_REGNUM = E_R0_REGNUM,
41 E_R1_REGNUM, E_ER1_REGNUM = E_R1_REGNUM, E_RET1_REGNUM = E_R1_REGNUM,
42 E_R2_REGNUM, E_ER2_REGNUM = E_R2_REGNUM, E_ARGLAST_REGNUM = E_R2_REGNUM,
43 E_R3_REGNUM, E_ER3_REGNUM = E_R3_REGNUM,
44 E_R4_REGNUM, E_ER4_REGNUM = E_R4_REGNUM,
45 E_R5_REGNUM, E_ER5_REGNUM = E_R5_REGNUM,
46 E_R6_REGNUM, E_ER6_REGNUM = E_R6_REGNUM, E_FP_REGNUM = E_R6_REGNUM,
51 E_TICK_REGNUM, E_EXR_REGNUM = E_TICK_REGNUM,
52 E_INST_REGNUM, E_TICKS_REGNUM = E_INST_REGNUM,
60 #define H8300_MAX_NUM_REGS 18
62 #define E_PSEUDO_CCR_REGNUM(gdbarch) (gdbarch_num_regs (gdbarch))
63 #define E_PSEUDO_EXR_REGNUM(gdbarch) (gdbarch_num_regs (gdbarch)+1)
65 struct h8300_frame_cache
72 /* Flag showing that a frame has been created in the prologue code. */
75 /* Saved registers. */
76 CORE_ADDR saved_regs[H8300_MAX_NUM_REGS];
84 h8300_max_reg_size = 4,
87 static int is_h8300hmode (struct gdbarch *gdbarch);
88 static int is_h8300smode (struct gdbarch *gdbarch);
89 static int is_h8300sxmode (struct gdbarch *gdbarch);
90 static int is_h8300_normal_mode (struct gdbarch *gdbarch);
92 #define BINWORD(gdbarch) ((is_h8300hmode (gdbarch) \
93 && !is_h8300_normal_mode (gdbarch)) \
94 ? h8300h_reg_size : h8300_reg_size)
97 h8300_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
99 return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
103 h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
105 return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
108 static struct frame_id
109 h8300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
111 CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
112 return frame_id_build (sp, get_frame_pc (this_frame));
117 /* Allocate and initialize a frame cache. */
120 h8300_init_frame_cache (struct gdbarch *gdbarch,
121 struct h8300_frame_cache *cache)
127 cache->sp_offset = 0;
130 /* Frameless until proven otherwise. */
133 /* Saved registers. We initialize these to -1 since zero is a valid
134 offset (that's where %fp is supposed to be stored). */
135 for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
136 cache->saved_regs[i] = -1;
139 #define IS_MOVB_RnRm(x) (((x) & 0xff88) == 0x0c88)
140 #define IS_MOVW_RnRm(x) (((x) & 0xff88) == 0x0d00)
141 #define IS_MOVL_RnRm(x) (((x) & 0xff88) == 0x0f80)
142 #define IS_MOVB_Rn16_SP(x) (((x) & 0xfff0) == 0x6ee0)
143 #define IS_MOVB_EXT(x) ((x) == 0x7860)
144 #define IS_MOVB_Rn24_SP(x) (((x) & 0xfff0) == 0x6aa0)
145 #define IS_MOVW_Rn16_SP(x) (((x) & 0xfff0) == 0x6fe0)
146 #define IS_MOVW_EXT(x) ((x) == 0x78e0)
147 #define IS_MOVW_Rn24_SP(x) (((x) & 0xfff0) == 0x6ba0)
148 /* Same instructions as mov.w, just prefixed with 0x0100. */
149 #define IS_MOVL_PRE(x) ((x) == 0x0100)
150 #define IS_MOVL_Rn16_SP(x) (((x) & 0xfff0) == 0x6fe0)
151 #define IS_MOVL_EXT(x) ((x) == 0x78e0)
152 #define IS_MOVL_Rn24_SP(x) (((x) & 0xfff0) == 0x6ba0)
154 #define IS_PUSHFP_MOVESPFP(x) ((x) == 0x6df60d76)
155 #define IS_PUSH_FP(x) ((x) == 0x01006df6)
156 #define IS_MOV_SP_FP(x) ((x) == 0x0ff6)
157 #define IS_SUB2_SP(x) ((x) == 0x1b87)
158 #define IS_SUB4_SP(x) ((x) == 0x1b97)
159 #define IS_ADD_IMM_SP(x) ((x) == 0x7a1f)
160 #define IS_SUB_IMM_SP(x) ((x) == 0x7a3f)
161 #define IS_SUBL4_SP(x) ((x) == 0x1acf)
162 #define IS_MOV_IMM_Rn(x) (((x) & 0xfff0) == 0x7905)
163 #define IS_SUB_RnSP(x) (((x) & 0xff0f) == 0x1907)
164 #define IS_ADD_RnSP(x) (((x) & 0xff0f) == 0x0907)
165 #define IS_PUSH(x) (((x) & 0xfff0) == 0x6df0)
167 /* If the instruction at PC is an argument register spill, return its
168 length. Otherwise, return zero.
170 An argument register spill is an instruction that moves an argument
171 from the register in which it was passed to the stack slot in which
172 it really lives. It is a byte, word, or longword move from an
173 argument register to a negative offset from the frame pointer.
175 CV, 2003-06-16: Or, in optimized code or when the `register' qualifier
176 is used, it could be a byte, word or long move to registers r3-r5. */
179 h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
181 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
182 int w = read_memory_unsigned_integer (pc, 2, byte_order);
184 if ((IS_MOVB_RnRm (w) || IS_MOVW_RnRm (w) || IS_MOVL_RnRm (w))
185 && (w & 0x70) <= 0x20 /* Rs is R0, R1 or R2 */
186 && (w & 0x7) >= 0x3 && (w & 0x7) <= 0x5) /* Rd is R3, R4 or R5 */
189 if (IS_MOVB_Rn16_SP (w)
190 && 8 <= (w & 0xf) && (w & 0xf) <= 10) /* Rs is R0L, R1L, or R2L */
192 /* ... and d:16 is negative. */
193 if (read_memory_integer (pc + 2, 2, byte_order) < 0)
196 else if (IS_MOVB_EXT (w))
198 if (IS_MOVB_Rn24_SP (read_memory_unsigned_integer (pc + 2,
201 LONGEST disp = read_memory_integer (pc + 4, 4, byte_order);
203 /* ... and d:24 is negative. */
204 if (disp < 0 && disp > 0xffffff)
208 else if (IS_MOVW_Rn16_SP (w)
209 && (w & 0xf) <= 2) /* Rs is R0, R1, or R2 */
211 /* ... and d:16 is negative. */
212 if (read_memory_integer (pc + 2, 2, byte_order) < 0)
215 else if (IS_MOVW_EXT (w))
217 if (IS_MOVW_Rn24_SP (read_memory_unsigned_integer (pc + 2,
220 LONGEST disp = read_memory_integer (pc + 4, 4, byte_order);
222 /* ... and d:24 is negative. */
223 if (disp < 0 && disp > 0xffffff)
227 else if (IS_MOVL_PRE (w))
229 int w2 = read_memory_integer (pc + 2, 2, byte_order);
231 if (IS_MOVL_Rn16_SP (w2)
232 && (w2 & 0xf) <= 2) /* Rs is ER0, ER1, or ER2 */
234 /* ... and d:16 is negative. */
235 if (read_memory_integer (pc + 4, 2, byte_order) < 0)
238 else if (IS_MOVL_EXT (w2))
240 int w3 = read_memory_integer (pc + 4, 2, byte_order);
242 if (IS_MOVL_Rn24_SP (read_memory_integer (pc + 4, 2, byte_order)))
244 LONGEST disp = read_memory_integer (pc + 6, 4, byte_order);
246 /* ... and d:24 is negative. */
247 if (disp < 0 && disp > 0xffffff)
256 /* Do a full analysis of the prologue at PC and update CACHE
257 accordingly. Bail out early if CURRENT_PC is reached. Return the
258 address where the analysis stopped.
260 We handle all cases that can be generated by gcc.
262 For allocating a stack frame:
283 For saving registers:
292 h8300_analyze_prologue (struct gdbarch *gdbarch,
293 CORE_ADDR pc, CORE_ADDR current_pc,
294 struct h8300_frame_cache *cache)
296 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
298 int regno, i, spill_size;
300 cache->sp_offset = 0;
302 if (pc >= current_pc)
305 op = read_memory_unsigned_integer (pc, 4, byte_order);
307 if (IS_PUSHFP_MOVESPFP (op))
309 cache->saved_regs[E_FP_REGNUM] = 0;
313 else if (IS_PUSH_FP (op))
315 cache->saved_regs[E_FP_REGNUM] = 0;
317 if (pc >= current_pc)
319 op = read_memory_unsigned_integer (pc, 2, byte_order);
320 if (IS_MOV_SP_FP (op))
327 while (pc < current_pc)
329 op = read_memory_unsigned_integer (pc, 2, byte_order);
332 cache->sp_offset += 2;
335 else if (IS_SUB4_SP (op))
337 cache->sp_offset += 4;
340 else if (IS_ADD_IMM_SP (op))
342 cache->sp_offset += -read_memory_integer (pc + 2, 2, byte_order);
345 else if (IS_SUB_IMM_SP (op))
347 cache->sp_offset += read_memory_integer (pc + 2, 2, byte_order);
350 else if (IS_SUBL4_SP (op))
352 cache->sp_offset += 4;
355 else if (IS_MOV_IMM_Rn (op))
357 int offset = read_memory_integer (pc + 2, 2, byte_order);
359 op = read_memory_unsigned_integer (pc + 4, 2, byte_order);
360 if (IS_ADD_RnSP (op) && (op & 0x00f0) == regno)
362 cache->sp_offset -= offset;
365 else if (IS_SUB_RnSP (op) && (op & 0x00f0) == regno)
367 cache->sp_offset += offset;
373 else if (IS_PUSH (op))
376 cache->sp_offset += 2;
377 cache->saved_regs[regno] = cache->sp_offset;
380 else if (op == 0x0100)
382 op = read_memory_unsigned_integer (pc + 2, 2, byte_order);
386 cache->sp_offset += 4;
387 cache->saved_regs[regno] = cache->sp_offset;
393 else if ((op & 0xffcf) == 0x0100)
396 op1 = read_memory_unsigned_integer (pc + 2, 2, byte_order);
399 /* Since the prefix is 0x01x0, this is not a simple pushm but a
400 stm.l reglist,@-sp */
401 i = ((op & 0x0030) >> 4) + 1;
402 regno = op1 & 0x000f;
403 for (; i > 0; regno++, --i)
405 cache->sp_offset += 4;
406 cache->saved_regs[regno] = cache->sp_offset;
417 /* Check for spilling an argument register to the stack frame.
418 This could also be an initializing store from non-prologue code,
419 but I don't think there's any harm in skipping that. */
420 while ((spill_size = h8300_is_argument_spill (gdbarch, pc)) > 0
421 && pc + spill_size <= current_pc)
427 static struct h8300_frame_cache *
428 h8300_frame_cache (struct frame_info *this_frame, void **this_cache)
430 struct gdbarch *gdbarch = get_frame_arch (this_frame);
431 struct h8300_frame_cache *cache;
433 CORE_ADDR current_pc;
438 cache = FRAME_OBSTACK_ZALLOC (struct h8300_frame_cache);
439 h8300_init_frame_cache (gdbarch, cache);
442 /* In principle, for normal frames, %fp holds the frame pointer,
443 which holds the base address for the current stack frame.
444 However, for functions that don't need it, the frame pointer is
445 optional. For these "frameless" functions the frame pointer is
446 actually the frame pointer of the calling frame. */
448 cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM);
449 if (cache->base == 0)
452 cache->saved_regs[E_PC_REGNUM] = -BINWORD (gdbarch);
454 cache->pc = get_frame_func (this_frame);
455 current_pc = get_frame_pc (this_frame);
457 h8300_analyze_prologue (gdbarch, cache->pc, current_pc, cache);
461 /* We didn't find a valid frame, which means that CACHE->base
462 currently holds the frame pointer for our calling frame. If
463 we're at the start of a function, or somewhere half-way its
464 prologue, the function's frame probably hasn't been fully
465 setup yet. Try to reconstruct the base address for the stack
466 frame by looking at the stack pointer. For truly "frameless"
467 functions this might work too. */
469 cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM)
471 cache->saved_sp = cache->base + BINWORD (gdbarch);
472 cache->saved_regs[E_PC_REGNUM] = 0;
476 cache->saved_sp = cache->base + 2 * BINWORD (gdbarch);
477 cache->saved_regs[E_PC_REGNUM] = -BINWORD (gdbarch);
480 /* Adjust all the saved registers such that they contain addresses
481 instead of offsets. */
482 for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
483 if (cache->saved_regs[i] != -1)
484 cache->saved_regs[i] = cache->base - cache->saved_regs[i];
490 h8300_frame_this_id (struct frame_info *this_frame, void **this_cache,
491 struct frame_id *this_id)
493 struct h8300_frame_cache *cache =
494 h8300_frame_cache (this_frame, this_cache);
496 /* This marks the outermost frame. */
497 if (cache->base == 0)
500 *this_id = frame_id_build (cache->saved_sp, cache->pc);
503 static struct value *
504 h8300_frame_prev_register (struct frame_info *this_frame, void **this_cache,
507 struct gdbarch *gdbarch = get_frame_arch (this_frame);
508 struct h8300_frame_cache *cache =
509 h8300_frame_cache (this_frame, this_cache);
511 gdb_assert (regnum >= 0);
513 if (regnum == E_SP_REGNUM && cache->saved_sp)
514 return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
516 if (regnum < gdbarch_num_regs (gdbarch)
517 && cache->saved_regs[regnum] != -1)
518 return frame_unwind_got_memory (this_frame, regnum,
519 cache->saved_regs[regnum]);
521 return frame_unwind_got_register (this_frame, regnum, regnum);
524 static const struct frame_unwind h8300_frame_unwind = {
526 default_frame_unwind_stop_reason,
528 h8300_frame_prev_register,
530 default_frame_sniffer
534 h8300_frame_base_address (struct frame_info *this_frame, void **this_cache)
536 struct h8300_frame_cache *cache = h8300_frame_cache (this_frame, this_cache);
540 static const struct frame_base h8300_frame_base = {
542 h8300_frame_base_address,
543 h8300_frame_base_address,
544 h8300_frame_base_address
548 h8300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
550 CORE_ADDR func_addr = 0 , func_end = 0;
552 if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
554 struct symtab_and_line sal;
555 struct h8300_frame_cache cache;
557 /* Found a function. */
558 sal = find_pc_line (func_addr, 0);
559 if (sal.end && sal.end < func_end)
560 /* Found a line number, use it as end of prologue. */
563 /* No useable line symbol. Use prologue parsing method. */
564 h8300_init_frame_cache (gdbarch, &cache);
565 return h8300_analyze_prologue (gdbarch, func_addr, func_end, &cache);
568 /* No function symbol -- just return the PC. */
569 return (CORE_ADDR) pc;
572 /* Function: push_dummy_call
573 Setup the function arguments for calling a function in the inferior.
574 In this discussion, a `word' is 16 bits on the H8/300s, and 32 bits
577 There are actually two ABI's here: -mquickcall (the default) and
578 -mno-quickcall. With -mno-quickcall, all arguments are passed on
579 the stack after the return address, word-aligned. With
580 -mquickcall, GCC tries to use r0 -- r2 to pass registers. Since
581 GCC doesn't indicate in the object file which ABI was used to
582 compile it, GDB only supports the default --- -mquickcall.
584 Here are the rules for -mquickcall, in detail:
586 Each argument, whether scalar or aggregate, is padded to occupy a
587 whole number of words. Arguments smaller than a word are padded at
588 the most significant end; those larger than a word are padded at
589 the least significant end.
591 The initial arguments are passed in r0 -- r2. Earlier arguments go in
592 lower-numbered registers. Multi-word arguments are passed in
593 consecutive registers, with the most significant end in the
594 lower-numbered register.
596 If an argument doesn't fit entirely in the remaining registers, it
597 is passed entirely on the stack. Stack arguments begin just after
598 the return address. Once an argument has overflowed onto the stack
599 this way, all subsequent arguments are passed on the stack.
601 The above rule has odd consequences. For example, on the h8/300s,
602 if a function takes two longs and an int as arguments:
603 - the first long will be passed in r0/r1,
604 - the second long will be passed entirely on the stack, since it
606 - and the int will be passed on the stack, even though it could fit
609 A weird exception: if an argument is larger than a word, but not a
610 whole number of words in length (before padding), it is passed on
611 the stack following the rules for stack arguments above, even if
612 there are sufficient registers available to hold it. Stranger
613 still, the argument registers are still `used up' --- even though
614 there's nothing in them.
616 So, for example, on the h8/300s, if a function expects a three-byte
617 structure and an int, the structure will go on the stack, and the
618 int will go in r2, not r0.
620 If the function returns an aggregate type (struct, union, or class)
621 by value, the caller must allocate space to hold the return value,
622 and pass the callee a pointer to this space as an invisible first
625 For varargs functions, the last fixed argument and all the variable
626 arguments are always passed on the stack. This means that calls to
627 varargs functions don't work properly unless there is a prototype
630 Basically, this ABI is not good, for the following reasons:
631 - You can't call vararg functions properly unless a prototype is in scope.
632 - Structure passing is inconsistent, to no purpose I can see.
633 - It often wastes argument registers, of which there are only three
637 h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
638 struct regcache *regcache, CORE_ADDR bp_addr,
639 int nargs, struct value **args, CORE_ADDR sp,
640 int struct_return, CORE_ADDR struct_addr)
642 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
643 int stack_alloc = 0, stack_offset = 0;
644 int wordsize = BINWORD (gdbarch);
645 int reg = E_ARG0_REGNUM;
648 /* First, make sure the stack is properly aligned. */
649 sp = align_down (sp, wordsize);
651 /* Now make sure there's space on the stack for the arguments. We
652 may over-allocate a little here, but that won't hurt anything. */
653 for (argument = 0; argument < nargs; argument++)
654 stack_alloc += align_up (TYPE_LENGTH (value_type (args[argument])),
658 /* Now load as many arguments as possible into registers, and push
659 the rest onto the stack.
660 If we're returning a structure by value, then we must pass a
661 pointer to the buffer for the return value as an invisible first
664 regcache_cooked_write_unsigned (regcache, reg++, struct_addr);
666 for (argument = 0; argument < nargs; argument++)
668 struct cleanup *back_to;
669 struct type *type = value_type (args[argument]);
670 int len = TYPE_LENGTH (type);
671 char *contents = (char *) value_contents (args[argument]);
673 /* Pad the argument appropriately. */
674 int padded_len = align_up (len, wordsize);
675 gdb_byte *padded = xmalloc (padded_len);
676 back_to = make_cleanup (xfree, padded);
678 memset (padded, 0, padded_len);
679 memcpy (len < wordsize ? padded + padded_len - len : padded,
682 /* Could the argument fit in the remaining registers? */
683 if (padded_len <= (E_ARGLAST_REGNUM - reg + 1) * wordsize)
685 /* Are we going to pass it on the stack anyway, for no good
687 if (len > wordsize && len % wordsize)
689 /* I feel so unclean. */
690 write_memory (sp + stack_offset, padded, padded_len);
691 stack_offset += padded_len;
693 /* That's right --- even though we passed the argument
694 on the stack, we consume the registers anyway! Love
696 reg += padded_len / wordsize;
700 /* Heavens to Betsy --- it's really going in registers!
701 Note that on the h8/300s, there are gaps between the
702 registers in the register file. */
705 for (offset = 0; offset < padded_len; offset += wordsize)
708 = extract_unsigned_integer (padded + offset,
709 wordsize, byte_order);
710 regcache_cooked_write_unsigned (regcache, reg++, word);
716 /* It doesn't fit in registers! Onto the stack it goes. */
717 write_memory (sp + stack_offset, padded, padded_len);
718 stack_offset += padded_len;
720 /* Once one argument has spilled onto the stack, all
721 subsequent arguments go on the stack. */
722 reg = E_ARGLAST_REGNUM + 1;
725 do_cleanups (back_to);
728 /* Store return address. */
730 write_memory_unsigned_integer (sp, wordsize, byte_order, bp_addr);
732 /* Update stack pointer. */
733 regcache_cooked_write_unsigned (regcache, E_SP_REGNUM, sp);
735 /* Return the new stack pointer minus the return address slot since
736 that's what DWARF2/GCC uses as the frame's CFA. */
737 return sp + wordsize;
740 /* Function: extract_return_value
741 Figure out where in REGBUF the called function has left its return value.
742 Copy that into VALBUF. Be sure to account for CPU type. */
745 h8300_extract_return_value (struct type *type, struct regcache *regcache,
748 struct gdbarch *gdbarch = get_regcache_arch (regcache);
749 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
750 int len = TYPE_LENGTH (type);
757 regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
758 store_unsigned_integer (valbuf, len, byte_order, c);
760 case 4: /* Needs two registers on plain H8/300 */
761 regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
762 store_unsigned_integer (valbuf, 2, byte_order, c);
763 regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c);
764 store_unsigned_integer ((void *)((char *) valbuf + 2), 2, byte_order, c);
766 case 8: /* long long is now 8 bytes. */
767 if (TYPE_CODE (type) == TYPE_CODE_INT)
769 regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr);
770 c = read_memory_unsigned_integer ((CORE_ADDR) addr, len, byte_order);
771 store_unsigned_integer (valbuf, len, byte_order, c);
775 error (_("I don't know how this 8 byte value is returned."));
782 h8300h_extract_return_value (struct type *type, struct regcache *regcache,
785 struct gdbarch *gdbarch = get_regcache_arch (regcache);
786 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
789 switch (TYPE_LENGTH (type))
794 regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
795 store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c);
797 case 8: /* long long is now 8 bytes. */
798 if (TYPE_CODE (type) == TYPE_CODE_INT)
800 regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
801 store_unsigned_integer (valbuf, 4, byte_order, c);
802 regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c);
803 store_unsigned_integer ((void *) ((char *) valbuf + 4), 4,
808 error (_("I don't know how this 8 byte value is returned."));
815 h8300_use_struct_convention (struct type *value_type)
817 /* Types of 1, 2 or 4 bytes are returned in R0/R1, everything else on the
820 if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT
821 || TYPE_CODE (value_type) == TYPE_CODE_UNION)
823 return !(TYPE_LENGTH (value_type) == 1
824 || TYPE_LENGTH (value_type) == 2
825 || TYPE_LENGTH (value_type) == 4);
829 h8300h_use_struct_convention (struct type *value_type)
831 /* Types of 1, 2 or 4 bytes are returned in R0, INT types of 8 bytes are
832 returned in R0/R1, everything else on the stack. */
833 if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT
834 || TYPE_CODE (value_type) == TYPE_CODE_UNION)
836 return !(TYPE_LENGTH (value_type) == 1
837 || TYPE_LENGTH (value_type) == 2
838 || TYPE_LENGTH (value_type) == 4
839 || (TYPE_LENGTH (value_type) == 8
840 && TYPE_CODE (value_type) == TYPE_CODE_INT));
843 /* Function: store_return_value
844 Place the appropriate value in the appropriate registers.
845 Primarily used by the RETURN command. */
848 h8300_store_return_value (struct type *type, struct regcache *regcache,
851 struct gdbarch *gdbarch = get_regcache_arch (regcache);
852 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
855 switch (TYPE_LENGTH (type))
858 case 2: /* short... */
859 val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
860 regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
862 case 4: /* long, float */
863 val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
864 regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
865 (val >> 16) & 0xffff);
866 regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff);
868 case 8: /* long long, double and long double
869 are all defined as 4 byte types so
870 far so this shouldn't happen. */
871 error (_("I don't know how to return an 8 byte value."));
877 h8300h_store_return_value (struct type *type, struct regcache *regcache,
880 struct gdbarch *gdbarch = get_regcache_arch (regcache);
881 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
884 switch (TYPE_LENGTH (type))
888 case 4: /* long, float */
889 val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
890 regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
893 val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order);
894 regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
895 (val >> 32) & 0xffffffff);
896 regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM,
902 static enum return_value_convention
903 h8300_return_value (struct gdbarch *gdbarch, struct value *function,
904 struct type *type, struct regcache *regcache,
905 gdb_byte *readbuf, const gdb_byte *writebuf)
907 if (h8300_use_struct_convention (type))
908 return RETURN_VALUE_STRUCT_CONVENTION;
910 h8300_store_return_value (type, regcache, writebuf);
912 h8300_extract_return_value (type, regcache, readbuf);
913 return RETURN_VALUE_REGISTER_CONVENTION;
916 static enum return_value_convention
917 h8300h_return_value (struct gdbarch *gdbarch, struct value *function,
918 struct type *type, struct regcache *regcache,
919 gdb_byte *readbuf, const gdb_byte *writebuf)
921 if (h8300h_use_struct_convention (type))
927 regcache_raw_read_unsigned (regcache, E_R0_REGNUM, &addr);
928 read_memory (addr, readbuf, TYPE_LENGTH (type));
931 return RETURN_VALUE_ABI_RETURNS_ADDRESS;
934 h8300h_store_return_value (type, regcache, writebuf);
936 h8300h_extract_return_value (type, regcache, readbuf);
937 return RETURN_VALUE_REGISTER_CONVENTION;
940 /* Implementation of 'register_sim_regno' gdbarch method. */
943 h8300_register_sim_regno (struct gdbarch *gdbarch, int regnum)
945 /* Only makes sense to supply raw registers. */
946 gdb_assert (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch));
948 /* We hide the raw ccr from the user by making it nameless. Because
949 the default register_sim_regno hook returns
950 LEGACY_SIM_REGNO_IGNORE for unnamed registers, we need to
951 override it. The sim register numbering is compatible with
957 h8300_register_name (struct gdbarch *gdbarch, int regno)
959 /* The register names change depending on which h8300 processor
961 static char *register_names[] = {
962 "r0", "r1", "r2", "r3", "r4", "r5", "r6",
963 "sp", "", "pc", "cycles", "tick", "inst",
964 "ccr", /* pseudo register */
967 || regno >= (sizeof (register_names) / sizeof (*register_names)))
968 internal_error (__FILE__, __LINE__,
969 _("h8300_register_name: illegal register number %d"),
972 return register_names[regno];
976 h8300s_register_name (struct gdbarch *gdbarch, int regno)
978 static char *register_names[] = {
979 "er0", "er1", "er2", "er3", "er4", "er5", "er6",
980 "sp", "", "pc", "cycles", "", "tick", "inst",
982 "ccr", "exr" /* pseudo registers */
985 || regno >= (sizeof (register_names) / sizeof (*register_names)))
986 internal_error (__FILE__, __LINE__,
987 _("h8300s_register_name: illegal register number %d"),
990 return register_names[regno];
994 h8300sx_register_name (struct gdbarch *gdbarch, int regno)
996 static char *register_names[] = {
997 "er0", "er1", "er2", "er3", "er4", "er5", "er6",
998 "sp", "", "pc", "cycles", "", "tick", "inst",
999 "mach", "macl", "sbr", "vbr",
1000 "ccr", "exr" /* pseudo registers */
1003 || regno >= (sizeof (register_names) / sizeof (*register_names)))
1004 internal_error (__FILE__, __LINE__,
1005 _("h8300sx_register_name: illegal register number %d"),
1008 return register_names[regno];
1012 h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file,
1013 struct frame_info *frame, int regno)
1016 const char *name = gdbarch_register_name (gdbarch, regno);
1018 if (!name || !*name)
1021 rval = get_frame_register_signed (frame, regno);
1023 fprintf_filtered (file, "%-14s ", name);
1024 if ((regno == E_PSEUDO_CCR_REGNUM (gdbarch)) || \
1025 (regno == E_PSEUDO_EXR_REGNUM (gdbarch) && is_h8300smode (gdbarch)))
1027 fprintf_filtered (file, "0x%02x ", (unsigned char) rval);
1028 print_longest (file, 'u', 1, rval);
1032 fprintf_filtered (file, "0x%s ", phex ((ULONGEST) rval,
1033 BINWORD (gdbarch)));
1034 print_longest (file, 'd', 1, rval);
1036 if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
1040 unsigned char l = rval & 0xff;
1041 fprintf_filtered (file, "\t");
1042 fprintf_filtered (file, "I-%d ", (l & 0x80) != 0);
1043 fprintf_filtered (file, "UI-%d ", (l & 0x40) != 0);
1044 fprintf_filtered (file, "H-%d ", (l & 0x20) != 0);
1045 fprintf_filtered (file, "U-%d ", (l & 0x10) != 0);
1050 fprintf_filtered (file, "N-%d ", N);
1051 fprintf_filtered (file, "Z-%d ", Z);
1052 fprintf_filtered (file, "V-%d ", V);
1053 fprintf_filtered (file, "C-%d ", C);
1055 fprintf_filtered (file, "u> ");
1057 fprintf_filtered (file, "u<= ");
1059 fprintf_filtered (file, "u>= ");
1061 fprintf_filtered (file, "u< ");
1063 fprintf_filtered (file, "!= ");
1065 fprintf_filtered (file, "== ");
1067 fprintf_filtered (file, ">= ");
1069 fprintf_filtered (file, "< ");
1070 if ((Z | (N ^ V)) == 0)
1071 fprintf_filtered (file, "> ");
1072 if ((Z | (N ^ V)) == 1)
1073 fprintf_filtered (file, "<= ");
1075 else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch) && is_h8300smode (gdbarch))
1078 unsigned char l = rval & 0xff;
1079 fprintf_filtered (file, "\t");
1080 fprintf_filtered (file, "T-%d - - - ", (l & 0x80) != 0);
1081 fprintf_filtered (file, "I2-%d ", (l & 4) != 0);
1082 fprintf_filtered (file, "I1-%d ", (l & 2) != 0);
1083 fprintf_filtered (file, "I0-%d", (l & 1) != 0);
1085 fprintf_filtered (file, "\n");
1089 h8300_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
1090 struct frame_info *frame, int regno, int cpregs)
1094 for (regno = E_R0_REGNUM; regno <= E_SP_REGNUM; ++regno)
1095 h8300_print_register (gdbarch, file, frame, regno);
1096 h8300_print_register (gdbarch, file, frame,
1097 E_PSEUDO_CCR_REGNUM (gdbarch));
1098 h8300_print_register (gdbarch, file, frame, E_PC_REGNUM);
1099 if (is_h8300smode (gdbarch))
1101 h8300_print_register (gdbarch, file, frame,
1102 E_PSEUDO_EXR_REGNUM (gdbarch));
1103 if (is_h8300sxmode (gdbarch))
1105 h8300_print_register (gdbarch, file, frame, E_SBR_REGNUM);
1106 h8300_print_register (gdbarch, file, frame, E_VBR_REGNUM);
1108 h8300_print_register (gdbarch, file, frame, E_MACH_REGNUM);
1109 h8300_print_register (gdbarch, file, frame, E_MACL_REGNUM);
1110 h8300_print_register (gdbarch, file, frame, E_CYCLES_REGNUM);
1111 h8300_print_register (gdbarch, file, frame, E_TICKS_REGNUM);
1112 h8300_print_register (gdbarch, file, frame, E_INSTS_REGNUM);
1116 h8300_print_register (gdbarch, file, frame, E_CYCLES_REGNUM);
1117 h8300_print_register (gdbarch, file, frame, E_TICK_REGNUM);
1118 h8300_print_register (gdbarch, file, frame, E_INST_REGNUM);
1123 if (regno == E_CCR_REGNUM)
1124 h8300_print_register (gdbarch, file, frame,
1125 E_PSEUDO_CCR_REGNUM (gdbarch));
1126 else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch)
1127 && is_h8300smode (gdbarch))
1128 h8300_print_register (gdbarch, file, frame,
1129 E_PSEUDO_EXR_REGNUM (gdbarch));
1131 h8300_print_register (gdbarch, file, frame, regno);
1135 static struct type *
1136 h8300_register_type (struct gdbarch *gdbarch, int regno)
1138 if (regno < 0 || regno >= gdbarch_num_regs (gdbarch)
1139 + gdbarch_num_pseudo_regs (gdbarch))
1140 internal_error (__FILE__, __LINE__,
1141 _("h8300_register_type: illegal register number %d"),
1148 return builtin_type (gdbarch)->builtin_func_ptr;
1151 return builtin_type (gdbarch)->builtin_data_ptr;
1153 if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
1154 return builtin_type (gdbarch)->builtin_uint8;
1155 else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
1156 return builtin_type (gdbarch)->builtin_uint8;
1157 else if (is_h8300hmode (gdbarch))
1158 return builtin_type (gdbarch)->builtin_int32;
1160 return builtin_type (gdbarch)->builtin_int16;
1165 /* Helpers for h8300_pseudo_register_read. We expose ccr/exr as
1166 pseudo-registers to users with smaller sizes than the corresponding
1167 raw registers. These helpers extend/narrow the values. */
1169 static enum register_status
1170 pseudo_from_raw_register (struct gdbarch *gdbarch, struct regcache *regcache,
1171 gdb_byte *buf, int pseudo_regno, int raw_regno)
1173 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1174 enum register_status status;
1177 status = regcache_raw_read_unsigned (regcache, raw_regno, &val);
1178 if (status == REG_VALID)
1179 store_unsigned_integer (buf,
1180 register_size (gdbarch, pseudo_regno),
1185 /* See pseudo_from_raw_register. */
1188 raw_from_pseudo_register (struct gdbarch *gdbarch, struct regcache *regcache,
1189 const gdb_byte *buf, int raw_regno, int pseudo_regno)
1191 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1194 val = extract_unsigned_integer (buf, register_size (gdbarch, pseudo_regno),
1196 regcache_raw_write_unsigned (regcache, raw_regno, val);
1199 static enum register_status
1200 h8300_pseudo_register_read (struct gdbarch *gdbarch,
1201 struct regcache *regcache, int regno,
1204 if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
1206 return pseudo_from_raw_register (gdbarch, regcache, buf,
1207 regno, E_CCR_REGNUM);
1209 else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
1211 return pseudo_from_raw_register (gdbarch, regcache, buf,
1212 regno, E_EXR_REGNUM);
1215 return regcache_raw_read (regcache, regno, buf);
1219 h8300_pseudo_register_write (struct gdbarch *gdbarch,
1220 struct regcache *regcache, int regno,
1221 const gdb_byte *buf)
1223 if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
1224 raw_from_pseudo_register (gdbarch, regcache, buf, E_CCR_REGNUM, regno);
1225 else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
1226 raw_from_pseudo_register (gdbarch, regcache, buf, E_EXR_REGNUM, regno);
1228 regcache_raw_write (regcache, regno, buf);
1232 h8300_dbg_reg_to_regnum (struct gdbarch *gdbarch, int regno)
1234 if (regno == E_CCR_REGNUM)
1235 return E_PSEUDO_CCR_REGNUM (gdbarch);
1240 h8300s_dbg_reg_to_regnum (struct gdbarch *gdbarch, int regno)
1242 if (regno == E_CCR_REGNUM)
1243 return E_PSEUDO_CCR_REGNUM (gdbarch);
1244 if (regno == E_EXR_REGNUM)
1245 return E_PSEUDO_EXR_REGNUM (gdbarch);
1249 static const unsigned char *
1250 h8300_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
1253 /*static unsigned char breakpoint[] = { 0x7A, 0xFF }; *//* ??? */
1254 static unsigned char breakpoint[] = { 0x01, 0x80 }; /* Sleep */
1256 *lenptr = sizeof (breakpoint);
1261 h8300_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
1262 struct frame_info *frame, const char *args)
1264 fprintf_filtered (file, "\
1265 No floating-point info available for this processor.\n");
1268 static struct gdbarch *
1269 h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1271 struct gdbarch_tdep *tdep = NULL;
1272 struct gdbarch *gdbarch;
1274 arches = gdbarch_list_lookup_by_info (arches, &info);
1276 return arches->gdbarch;
1279 tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
1282 if (info.bfd_arch_info->arch != bfd_arch_h8300)
1285 gdbarch = gdbarch_alloc (&info, 0);
1287 set_gdbarch_register_sim_regno (gdbarch, h8300_register_sim_regno);
1289 switch (info.bfd_arch_info->mach)
1291 case bfd_mach_h8300:
1292 set_gdbarch_num_regs (gdbarch, 13);
1293 set_gdbarch_num_pseudo_regs (gdbarch, 1);
1294 set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
1295 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
1296 set_gdbarch_stab_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
1297 set_gdbarch_register_name (gdbarch, h8300_register_name);
1298 set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1299 set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1300 set_gdbarch_return_value (gdbarch, h8300_return_value);
1301 set_gdbarch_print_insn (gdbarch, print_insn_h8300);
1303 case bfd_mach_h8300h:
1304 case bfd_mach_h8300hn:
1305 set_gdbarch_num_regs (gdbarch, 13);
1306 set_gdbarch_num_pseudo_regs (gdbarch, 1);
1307 set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
1308 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
1309 set_gdbarch_stab_reg_to_regnum (gdbarch, h8300_dbg_reg_to_regnum);
1310 set_gdbarch_register_name (gdbarch, h8300_register_name);
1311 if (info.bfd_arch_info->mach != bfd_mach_h8300hn)
1313 set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1314 set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1318 set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1319 set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1321 set_gdbarch_return_value (gdbarch, h8300h_return_value);
1322 set_gdbarch_print_insn (gdbarch, print_insn_h8300h);
1324 case bfd_mach_h8300s:
1325 case bfd_mach_h8300sn:
1326 set_gdbarch_num_regs (gdbarch, 16);
1327 set_gdbarch_num_pseudo_regs (gdbarch, 2);
1328 set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
1329 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
1330 set_gdbarch_stab_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
1331 set_gdbarch_register_name (gdbarch, h8300s_register_name);
1332 if (info.bfd_arch_info->mach != bfd_mach_h8300sn)
1334 set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1335 set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1339 set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1340 set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1342 set_gdbarch_return_value (gdbarch, h8300h_return_value);
1343 set_gdbarch_print_insn (gdbarch, print_insn_h8300s);
1345 case bfd_mach_h8300sx:
1346 case bfd_mach_h8300sxn:
1347 set_gdbarch_num_regs (gdbarch, 18);
1348 set_gdbarch_num_pseudo_regs (gdbarch, 2);
1349 set_gdbarch_ecoff_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
1350 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
1351 set_gdbarch_stab_reg_to_regnum (gdbarch, h8300s_dbg_reg_to_regnum);
1352 set_gdbarch_register_name (gdbarch, h8300sx_register_name);
1353 if (info.bfd_arch_info->mach != bfd_mach_h8300sxn)
1355 set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1356 set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1360 set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1361 set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1363 set_gdbarch_return_value (gdbarch, h8300h_return_value);
1364 set_gdbarch_print_insn (gdbarch, print_insn_h8300s);
1368 set_gdbarch_pseudo_register_read (gdbarch, h8300_pseudo_register_read);
1369 set_gdbarch_pseudo_register_write (gdbarch, h8300_pseudo_register_write);
1372 * Basic register fields and methods.
1375 set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
1376 set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
1377 set_gdbarch_register_type (gdbarch, h8300_register_type);
1378 set_gdbarch_print_registers_info (gdbarch, h8300_print_registers_info);
1379 set_gdbarch_print_float_info (gdbarch, h8300_print_float_info);
1384 set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue);
1386 /* Frame unwinder. */
1387 set_gdbarch_unwind_pc (gdbarch, h8300_unwind_pc);
1388 set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
1389 set_gdbarch_dummy_id (gdbarch, h8300_dummy_id);
1390 frame_base_set_default (gdbarch, &h8300_frame_base);
1395 /* Stack grows up. */
1396 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
1398 set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
1399 set_gdbarch_push_dummy_call (gdbarch, h8300_push_dummy_call);
1401 set_gdbarch_char_signed (gdbarch, 0);
1402 set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1403 set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1404 set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
1405 set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1406 set_gdbarch_double_format (gdbarch, floatformats_ieee_single);
1407 set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1408 set_gdbarch_long_double_format (gdbarch, floatformats_ieee_single);
1410 set_gdbarch_believe_pcc_promotion (gdbarch, 1);
1412 /* Hook in the DWARF CFI frame unwinder. */
1413 dwarf2_append_unwinders (gdbarch);
1414 frame_unwind_append_unwinder (gdbarch, &h8300_frame_unwind);
1420 extern initialize_file_ftype _initialize_h8300_tdep; /* -Wmissing-prototypes */
1423 _initialize_h8300_tdep (void)
1425 register_gdbarch_init (bfd_arch_h8300, h8300_gdbarch_init);
1429 is_h8300hmode (struct gdbarch *gdbarch)
1431 return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sx
1432 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn
1433 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300s
1434 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn
1435 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300h
1436 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn;
1440 is_h8300smode (struct gdbarch *gdbarch)
1442 return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sx
1443 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn
1444 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300s
1445 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn;
1449 is_h8300sxmode (struct gdbarch *gdbarch)
1451 return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sx
1452 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn;
1456 is_h8300_normal_mode (struct gdbarch *gdbarch)
1458 return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn
1459 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn
1460 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn;