X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fsparc-tdep.c;h=bf711f0e6dddaac6f5f04d0cb7f522cfeebd2cbc;hb=e17a4113357102b55cfa5b80557d590a46a43300;hp=f6dbf3f5aba011aa87bd1c61b13ecebf06ff2971;hpb=209bd28e8ba1a8d4f3f5e90ea954437050870837;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index f6dbf3f5ab..bf711f0e6d 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -152,8 +152,9 @@ sparc_is_unimp_insn (CORE_ADDR pc) /* Fetch StackGhost Per-Process XOR cookie. */ ULONGEST -sparc_fetch_wcookie (void) +sparc_fetch_wcookie (struct gdbarch *gdbarch) { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); struct target_ops *ops = ¤t_target; gdb_byte buf[8]; int len; @@ -165,7 +166,7 @@ sparc_fetch_wcookie (void) /* We should have either an 32-bit or an 64-bit cookie. */ gdb_assert (len == 4 || len == 8); - return extract_unsigned_integer (buf, len); + return extract_unsigned_integer (buf, len, byte_order); } @@ -294,7 +295,7 @@ sparc_psr_type (struct gdbarch *gdbarch) { struct type *type; - type = init_flags_type ("builtin_type_sparc_psr", 4); + type = arch_flags_type (gdbarch, "builtin_type_sparc_psr", 4); append_flags_type_flag (type, 5, "ET"); append_flags_type_flag (type, 6, "PS"); append_flags_type_flag (type, 7, "S"); @@ -316,7 +317,7 @@ sparc_fsr_type (struct gdbarch *gdbarch) { struct type *type; - type = init_flags_type ("builtin_type_sparc_fsr", 4); + type = arch_flags_type (gdbarch, "builtin_type_sparc_fsr", 4); append_flags_type_flag (type, 0, "NXA"); append_flags_type_flag (type, 1, "DZA"); append_flags_type_flag (type, 2, "UFA"); @@ -400,6 +401,8 @@ sparc32_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache) { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + *bp_addr = sp - 4; *real_pc = funcaddr; @@ -408,7 +411,8 @@ sparc32_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, gdb_byte buf[4]; /* This is an UNIMP instruction. */ - store_unsigned_integer (buf, 4, TYPE_LENGTH (value_type) & 0x1fff); + store_unsigned_integer (buf, 4, byte_order, + TYPE_LENGTH (value_type) & 0x1fff); write_memory (sp - 8, buf, 4); return sp - 8; } @@ -422,6 +426,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs, int struct_return, CORE_ADDR struct_addr) { struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); /* Number of words in the "parameter array". */ int num_elements = 0; int element = 0; @@ -504,7 +509,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs, { gdb_byte buf[4]; - store_unsigned_integer (buf, 4, struct_addr); + store_unsigned_integer (buf, 4, byte_order, struct_addr); write_memory (sp, buf, 4); } @@ -954,6 +959,7 @@ static struct value * sparc32_frame_prev_register (struct frame_info *this_frame, void **this_cache, int regnum) { + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct sparc_frame_cache *cache = sparc32_frame_cache (this_frame, this_cache); @@ -974,7 +980,7 @@ sparc32_frame_prev_register (struct frame_info *this_frame, /* Handle StackGhost. */ { - ULONGEST wcookie = sparc_fetch_wcookie (); + ULONGEST wcookie = sparc_fetch_wcookie (gdbarch); if (wcookie != 0 && !cache->frameless_p && regnum == SPARC_I7_REGNUM) { @@ -1133,6 +1139,8 @@ sparc32_return_value (struct gdbarch *gdbarch, struct type *func_type, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + /* The psABI says that "...every stack frame reserves the word at %fp+64. If a function returns a structure, union, or quad-precision value, this word should hold the address of the @@ -1149,7 +1157,7 @@ sparc32_return_value (struct gdbarch *gdbarch, struct type *func_type, CORE_ADDR addr; regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp); - addr = read_memory_unsigned_integer (sp + 64, 4); + addr = read_memory_unsigned_integer (sp + 64, 4, byte_order); read_memory (addr, readbuf, TYPE_LENGTH (type)); } @@ -1314,10 +1322,10 @@ sparc_software_single_step (struct frame_info *frame) /* Analyze the instruction at PC. */ nnpc = sparc_analyze_control_transfer (frame, pc, &npc); if (npc != 0) - insert_single_step_breakpoint (npc); + insert_single_step_breakpoint (arch, npc); if (nnpc != 0) - insert_single_step_breakpoint (nnpc); + insert_single_step_breakpoint (arch, nnpc); /* Assert that we have set at least one breakpoint, and that they're not set at the same spot - unless we're going @@ -1448,6 +1456,8 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) void sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int offset = 0; gdb_byte buf[8]; int i; @@ -1466,10 +1476,12 @@ sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum) /* Handle StackGhost. */ if (i == SPARC_I7_REGNUM) { - ULONGEST wcookie = sparc_fetch_wcookie (); - ULONGEST i7 = extract_unsigned_integer (buf + offset, 8); + ULONGEST wcookie = sparc_fetch_wcookie (gdbarch); + ULONGEST i7; - store_unsigned_integer (buf + offset, 8, i7 ^ wcookie); + i7 = extract_unsigned_integer (buf + offset, 8, byte_order); + store_unsigned_integer (buf + offset, 8, byte_order, + i7 ^ wcookie); } regcache_raw_supply (regcache, i, buf); @@ -1500,10 +1512,12 @@ sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum) /* Handle StackGhost. */ if (i == SPARC_I7_REGNUM) { - ULONGEST wcookie = sparc_fetch_wcookie (); - ULONGEST i7 = extract_unsigned_integer (buf + offset, 4); + ULONGEST wcookie = sparc_fetch_wcookie (gdbarch); + ULONGEST i7; - store_unsigned_integer (buf + offset, 4, i7 ^ wcookie); + i7 = extract_unsigned_integer (buf + offset, 4, byte_order); + store_unsigned_integer (buf + offset, 4, byte_order, + i7 ^ wcookie); } regcache_raw_supply (regcache, i, buf); @@ -1516,6 +1530,8 @@ void sparc_collect_rwindow (const struct regcache *regcache, CORE_ADDR sp, int regnum) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int offset = 0; gdb_byte buf[8]; int i; @@ -1534,10 +1550,11 @@ sparc_collect_rwindow (const struct regcache *regcache, /* Handle StackGhost. */ if (i == SPARC_I7_REGNUM) { - ULONGEST wcookie = sparc_fetch_wcookie (); - ULONGEST i7 = extract_unsigned_integer (buf + offset, 8); + ULONGEST wcookie = sparc_fetch_wcookie (gdbarch); + ULONGEST i7; - store_unsigned_integer (buf, 8, i7 ^ wcookie); + i7 = extract_unsigned_integer (buf + offset, 8, byte_order); + store_unsigned_integer (buf, 8, byte_order, i7 ^ wcookie); } target_write_memory (sp + ((i - SPARC_L0_REGNUM) * 8), buf, 8); @@ -1563,10 +1580,12 @@ sparc_collect_rwindow (const struct regcache *regcache, /* Handle StackGhost. */ if (i == SPARC_I7_REGNUM) { - ULONGEST wcookie = sparc_fetch_wcookie (); - ULONGEST i7 = extract_unsigned_integer (buf + offset, 4); + ULONGEST wcookie = sparc_fetch_wcookie (gdbarch); + ULONGEST i7; - store_unsigned_integer (buf + offset, 4, i7 ^ wcookie); + i7 = extract_unsigned_integer (buf + offset, 4, byte_order); + store_unsigned_integer (buf + offset, 4, byte_order, + i7 ^ wcookie); } target_write_memory (sp + ((i - SPARC_L0_REGNUM) * 4),