OLD | NEW |
1 /* Target-machine dependent code for Renesas H8/300, for GDB. | 1 /* Target-machine dependent code for Renesas H8/300, for GDB. |
2 | 2 |
3 Copyright (C) 1988, 1990-1996, 1998-2003, 2005, 2007-2012 Free | 3 Copyright (C) 1988, 1990-1996, 1998-2003, 2005, 2007-2012 Free |
4 Software Foundation, Inc. | 4 Software Foundation, Inc. |
5 | 5 |
6 This file is part of GDB. | 6 This file is part of GDB. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 pc += spill_size; | 423 pc += spill_size; |
424 | 424 |
425 return pc; | 425 return pc; |
426 } | 426 } |
427 | 427 |
428 static struct h8300_frame_cache * | 428 static struct h8300_frame_cache * |
429 h8300_frame_cache (struct frame_info *this_frame, void **this_cache) | 429 h8300_frame_cache (struct frame_info *this_frame, void **this_cache) |
430 { | 430 { |
431 struct gdbarch *gdbarch = get_frame_arch (this_frame); | 431 struct gdbarch *gdbarch = get_frame_arch (this_frame); |
432 struct h8300_frame_cache *cache; | 432 struct h8300_frame_cache *cache; |
433 char buf[4]; | |
434 int i; | 433 int i; |
435 CORE_ADDR current_pc; | 434 CORE_ADDR current_pc; |
436 | 435 |
437 if (*this_cache) | 436 if (*this_cache) |
438 return *this_cache; | 437 return *this_cache; |
439 | 438 |
440 cache = FRAME_OBSTACK_ZALLOC (struct h8300_frame_cache); | 439 cache = FRAME_OBSTACK_ZALLOC (struct h8300_frame_cache); |
441 h8300_init_frame_cache (gdbarch, cache); | 440 h8300_init_frame_cache (gdbarch, cache); |
442 *this_cache = cache; | 441 *this_cache = cache; |
443 | 442 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 } | 775 } |
777 } | 776 } |
778 | 777 |
779 static void | 778 static void |
780 h8300h_extract_return_value (struct type *type, struct regcache *regcache, | 779 h8300h_extract_return_value (struct type *type, struct regcache *regcache, |
781 void *valbuf) | 780 void *valbuf) |
782 { | 781 { |
783 struct gdbarch *gdbarch = get_regcache_arch (regcache); | 782 struct gdbarch *gdbarch = get_regcache_arch (regcache); |
784 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | 783 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
785 int len = TYPE_LENGTH (type); | 784 int len = TYPE_LENGTH (type); |
786 ULONGEST c, addr; | 785 ULONGEST c; |
787 | 786 |
788 switch (len) | 787 switch (len) |
789 { | 788 { |
790 case 1: | 789 case 1: |
791 case 2: | 790 case 2: |
792 case 4: | 791 case 4: |
793 regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); | 792 regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); |
794 store_unsigned_integer (valbuf, len, byte_order, c); | 793 store_unsigned_integer (valbuf, len, byte_order, c); |
795 break; | 794 break; |
796 case 8: /* long long is now 8 bytes. */ | 795 case 8: /* long long is now 8 bytes. */ |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 val = extract_unsigned_integer (valbuf, len, byte_order); | 893 val = extract_unsigned_integer (valbuf, len, byte_order); |
895 regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, | 894 regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, |
896 (val >> 32) & 0xffffffff); | 895 (val >> 32) & 0xffffffff); |
897 regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, | 896 regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, |
898 val & 0xffffffff); | 897 val & 0xffffffff); |
899 break; | 898 break; |
900 } | 899 } |
901 } | 900 } |
902 | 901 |
903 static enum return_value_convention | 902 static enum return_value_convention |
904 h8300_return_value (struct gdbarch *gdbarch, struct type *func_type, | 903 h8300_return_value (struct gdbarch *gdbarch, struct value *function, |
905 struct type *type, struct regcache *regcache, | 904 struct type *type, struct regcache *regcache, |
906 gdb_byte *readbuf, const gdb_byte *writebuf) | 905 gdb_byte *readbuf, const gdb_byte *writebuf) |
907 { | 906 { |
908 if (h8300_use_struct_convention (type)) | 907 if (h8300_use_struct_convention (type)) |
909 return RETURN_VALUE_STRUCT_CONVENTION; | 908 return RETURN_VALUE_STRUCT_CONVENTION; |
910 if (writebuf) | 909 if (writebuf) |
911 h8300_store_return_value (type, regcache, writebuf); | 910 h8300_store_return_value (type, regcache, writebuf); |
912 else if (readbuf) | 911 else if (readbuf) |
913 h8300_extract_return_value (type, regcache, readbuf); | 912 h8300_extract_return_value (type, regcache, readbuf); |
914 return RETURN_VALUE_REGISTER_CONVENTION; | 913 return RETURN_VALUE_REGISTER_CONVENTION; |
915 } | 914 } |
916 | 915 |
917 static enum return_value_convention | 916 static enum return_value_convention |
918 h8300h_return_value (struct gdbarch *gdbarch, struct type *func_type, | 917 h8300h_return_value (struct gdbarch *gdbarch, struct value *function, |
919 struct type *type, struct regcache *regcache, | 918 struct type *type, struct regcache *regcache, |
920 gdb_byte *readbuf, const gdb_byte *writebuf) | 919 gdb_byte *readbuf, const gdb_byte *writebuf) |
921 { | 920 { |
922 if (h8300h_use_struct_convention (type)) | 921 if (h8300h_use_struct_convention (type)) |
923 { | 922 { |
924 if (readbuf) | 923 if (readbuf) |
925 { | 924 { |
926 ULONGEST addr; | 925 ULONGEST addr; |
927 | 926 |
928 regcache_raw_read_unsigned (regcache, E_R0_REGNUM, &addr); | 927 regcache_raw_read_unsigned (regcache, E_R0_REGNUM, &addr); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn; | 1394 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn; |
1396 } | 1395 } |
1397 | 1396 |
1398 static int | 1397 static int |
1399 is_h8300_normal_mode (struct gdbarch *gdbarch) | 1398 is_h8300_normal_mode (struct gdbarch *gdbarch) |
1400 { | 1399 { |
1401 return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn | 1400 return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn |
1402 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn | 1401 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn |
1403 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn; | 1402 || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn; |
1404 } | 1403 } |
OLD | NEW |