static struct sparc_frame_cache * sparc64fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR fp, sp, trapframe_addr; int regnum; if (*this_cache) return (struct sparc_frame_cache *)*this_cache; cache = sparc_frame_cache (this_frame, this_cache); gdb_assert (cache == *this_cache); fp = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM); trapframe_addr = fp + BIAS - TRAPFRAME_SIZE; sp = get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM); cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); cache->saved_regs[SPARC_SP_REGNUM].addr = trapframe_addr + OFF_TF_SP; #ifdef notyet cache->saved_regs[SPARC64_STATE_REGNUM].addr = trapframe_addr + OFF_TF_TSTATE; #endif cache->saved_regs[SPARC64_PC_REGNUM].addr = trapframe_addr + OFF_TF_TPC; cache->saved_regs[SPARC64_NPC_REGNUM].addr = trapframe_addr + OFF_TF_TNPC; for (regnum = SPARC_O0_REGNUM; regnum <= SPARC_O7_REGNUM; regnum++) cache->saved_regs[regnum].addr = trapframe_addr + OFF_TF_OUT + (regnum - SPARC_O0_REGNUM) * 8; for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) cache->saved_regs[regnum].addr = sp + BIAS + (regnum - SPARC_L0_REGNUM) * 8; return cache; }
static struct sparc_frame_cache * sparc64obsd_frame_cache (struct frame_info *next_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR addr; if (*this_cache) return *this_cache; cache = sparc_frame_cache (next_frame, this_cache); gdb_assert (cache == *this_cache); /* If we couldn't find the frame's function, we're probably dealing with an on-stack signal trampoline. */ if (cache->pc == 0) { cache->pc = frame_pc_unwind (next_frame); cache->pc &= ~(sparc64obsd_page_size - 1); /* Since we couldn't find the frame's function, the cache was initialized under the assumption that we're frameless. */ cache->frameless_p = 0; addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM); cache->base = addr; } /* We find the appropriate instance of `struct sigcontext' at a fixed offset in the signal frame. */ addr = cache->base + BIAS + 128 + 16; cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame); return cache; }
struct sparc_frame_cache * sparc32_frame_cache (struct frame_info *next_frame, void **this_cache) { struct sparc_frame_cache *cache; struct symbol *sym; if (*this_cache) return *this_cache; cache = sparc_frame_cache (next_frame, this_cache); sym = find_pc_function (cache->pc); if (sym) { cache->struct_return_p = sparc32_struct_return_from_sym (sym); } else { /* There is no debugging information for this function to help us determine whether this function returns a struct or not. So we rely on another heuristic which is to check the instruction at the return address and see if this is an "unimp" instruction. If it is, then it is a struct-return function. */ CORE_ADDR pc; int regnum = cache->frameless_p ? SPARC_O7_REGNUM : SPARC_I7_REGNUM; pc = frame_unwind_register_unsigned (next_frame, regnum) + 8; if (sparc_is_unimp_insn (pc)) cache->struct_return_p = 1; } return cache; }
static struct sparc_frame_cache * sparc32nbsd_sigcontext_frame_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR addr; if (*this_cache) return *this_cache; cache = sparc_frame_cache (this_frame, this_cache); gdb_assert (cache == *this_cache); /* If we couldn't find the frame's function, we're probably dealing with an on-stack signal trampoline. */ if (cache->pc == 0) { cache->pc = sparc32nbsd_sigtramp_start; /* Since we couldn't find the frame's function, the cache was initialized under the assumption that we're frameless. */ sparc_record_save_insn (cache); addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM); cache->base = addr; } cache->saved_regs = sparc32nbsd_sigcontext_saved_regs (this_frame); return cache; }
static struct sparc_frame_cache * sparc64obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR sp, trapframe_addr; int regnum; if (*this_cache) return (struct sparc_frame_cache *) *this_cache; cache = sparc_frame_cache (this_frame, this_cache); gdb_assert (cache == *this_cache); sp = get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM); trapframe_addr = sp + BIAS + 176; cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); cache->saved_regs[SPARC64_STATE_REGNUM].addr = trapframe_addr; cache->saved_regs[SPARC64_PC_REGNUM].addr = trapframe_addr + 8; cache->saved_regs[SPARC64_NPC_REGNUM].addr = trapframe_addr + 16; for (regnum = SPARC_G0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) cache->saved_regs[regnum].addr = trapframe_addr + 48 + (regnum - SPARC_G0_REGNUM) * 8; return cache; }
static struct sparc_frame_cache * sparc64nbsd_sigcontext_frame_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR addr; if (*this_cache) return (struct sparc_frame_cache *) *this_cache; cache = sparc_frame_cache (this_frame, this_cache); gdb_assert (cache == *this_cache); /* If we couldn't find the frame's function, we're probably dealing with an on-stack signal trampoline. */ if (cache->pc == 0) { cache->pc = sparc64nbsd_sigtramp_start; /* Since we couldn't find the frame's function, the cache was initialized under the assumption that we're frameless. */ sparc_record_save_insn (cache); addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM); if (addr & 1) addr += BIAS; cache->base = addr; } /* We find the appropriate instance of `struct sigcontext' at a fixed offset in the signal frame. */ addr = cache->base + 128 + 8; cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, this_frame); return cache; }
struct sparc_frame_cache * sparc32_frame_cache (struct frame_info *next_frame, void **this_cache) { struct sparc_frame_cache *cache; struct symbol *sym; if (*this_cache) return *this_cache; cache = sparc_frame_cache (next_frame, this_cache); sym = find_pc_function (cache->pc); if (sym) { struct type *type = check_typedef (SYMBOL_TYPE (sym)); enum type_code code = TYPE_CODE (type); if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) { type = check_typedef (TYPE_TARGET_TYPE (type)); if (sparc_structure_or_union_p (type) || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16)) cache->struct_return_p = 1; } } return cache; }
static struct sparc_frame_cache * sparc64_sol2_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR mcontext_addr, addr; int regnum; if (*this_cache) return *this_cache; cache = sparc_frame_cache (this_frame, this_cache); gdb_assert (cache == *this_cache); cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* The third argument is a pointer to an instance of `ucontext_t', which has a member `uc_mcontext' that contains the saved registers. */ regnum = (cache->copied_regs_mask & 0x04) ? SPARC_I2_REGNUM : SPARC_O2_REGNUM; mcontext_addr = get_frame_register_unsigned (this_frame, regnum) + 64; cache->saved_regs[SPARC64_CCR_REGNUM].addr = mcontext_addr + 0 * 8; cache->saved_regs[SPARC64_PC_REGNUM].addr = mcontext_addr + 1 * 8; cache->saved_regs[SPARC64_NPC_REGNUM].addr = mcontext_addr + 2 * 8; cache->saved_regs[SPARC64_Y_REGNUM].addr = mcontext_addr + 3 * 8; cache->saved_regs[SPARC64_ASI_REGNUM].addr = mcontext_addr + 19 * 8; cache->saved_regs[SPARC64_FPRS_REGNUM].addr = mcontext_addr + 20 * 8; /* Since %g0 is always zero, keep the identity encoding. */ for (regnum = SPARC_G1_REGNUM, addr = mcontext_addr + 4 * 8; regnum <= SPARC_O7_REGNUM; regnum++, addr += 8) cache->saved_regs[regnum].addr = addr; if (get_frame_memory_unsigned (this_frame, mcontext_addr + 21 * 8, 8)) { /* The register windows haven't been flushed. */ for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) trad_frame_set_unknown (cache->saved_regs, regnum); } else { CORE_ADDR sp; addr = cache->saved_regs[SPARC_SP_REGNUM].addr; sp = get_frame_memory_unsigned (this_frame, addr, 8); for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS; regnum <= SPARC_I7_REGNUM; regnum++, addr += 8) cache->saved_regs[regnum].addr = addr; } return cache; }
static struct sparc_frame_cache * sparc32_sol2_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR mcontext_addr, addr; int regnum; if (*this_cache) return *this_cache; cache = sparc_frame_cache (next_frame, this_cache); gdb_assert (cache == *this_cache); cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); /* The third argument is a pointer to an instance of `ucontext_t', which has a member `uc_mcontext' that contains the saved registers. */ regnum = (cache->frameless_p ? SPARC_O2_REGNUM : SPARC_I2_REGNUM); mcontext_addr = frame_unwind_register_unsigned (next_frame, regnum) + 40; cache->saved_regs[SPARC32_PSR_REGNUM].addr = mcontext_addr + 0 * 4; cache->saved_regs[SPARC32_PC_REGNUM].addr = mcontext_addr + 1 * 4; cache->saved_regs[SPARC32_NPC_REGNUM].addr = mcontext_addr + 2 * 4; cache->saved_regs[SPARC32_Y_REGNUM].addr = mcontext_addr + 3 * 4; /* Since %g0 is always zero, keep the identity encoding. */ for (regnum = SPARC_G1_REGNUM, addr = mcontext_addr + 4 * 4; regnum <= SPARC_O7_REGNUM; regnum++, addr += 4) cache->saved_regs[regnum].addr = addr; if (get_frame_memory_unsigned (next_frame, mcontext_addr + 19 * 4, 4)) { /* The register windows haven't been flushed. */ for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) trad_frame_set_unknown (cache->saved_regs, regnum); } else { addr = cache->saved_regs[SPARC_SP_REGNUM].addr; addr = get_frame_memory_unsigned (next_frame, addr, 4); for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++, addr += 4) cache->saved_regs[regnum].addr = addr; } return cache; }
static struct sparc_frame_cache * sparc64fbsd_sigtramp_frame_cache(struct frame_info *next_frame, void **this_cache) { struct sparc_frame_cache *cache; CORE_ADDR addr, mcontext_addr, sp; LONGEST fprs; int regnum; if (*this_cache) return (struct sparc_frame_cache *)*this_cache; cache = sparc_frame_cache (next_frame, this_cache); gdb_assert (cache == *this_cache); cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); /* The third argument is a pointer to an instance of `ucontext_t', which has a member `uc_mcontext' that contains the saved registers. */ addr = frame_unwind_register_unsigned (next_frame, SPARC_O2_REGNUM); mcontext_addr = addr + 64; /* The following registers travel in the `mc_local' slots of `mcontext_t'. */ addr = mcontext_addr + 16 * 8; cache->saved_regs[SPARC64_FPRS_REGNUM].addr = addr + 0 * 8; cache->saved_regs[SPARC64_FSR_REGNUM].addr = addr + 1 * 8; /* The following registers travel in the `mc_in' slots of `mcontext_t'. */ addr = mcontext_addr + 24 * 8; cache->saved_regs[SPARC64_NPC_REGNUM].addr = addr + 0 * 8; cache->saved_regs[SPARC64_PC_REGNUM].addr = addr + 1 * 8; cache->saved_regs[SPARC64_STATE_REGNUM].addr = addr + 2 * 8; cache->saved_regs[SPARC64_Y_REGNUM].addr = addr + 4 * 8; /* The `global' and `out' registers travel in the `mc_global' and `mc_out' slots of `mcontext_t', except for %g0. Since %g0 is always zero, keep the identity encoding. */ for (regnum = SPARC_G1_REGNUM, addr = mcontext_addr + 8; regnum <= SPARC_O7_REGNUM; regnum++, addr += 8) cache->saved_regs[regnum].addr = addr; /* The `local' and `in' registers have been saved in the register save area. */ addr = cache->saved_regs[SPARC_SP_REGNUM].addr; sp = get_frame_memory_unsigned (next_frame, addr, 8); for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS; regnum <= SPARC_I7_REGNUM; regnum++, addr += 8) cache->saved_regs[regnum].addr = addr; /* The floating-point registers are only saved if the FEF bit in %fprs has been set. */ #define FPRS_FEF (1 << 2) addr = cache->saved_regs[SPARC64_FPRS_REGNUM].addr; fprs = get_frame_memory_unsigned (next_frame, addr, 8); if (fprs & FPRS_FEF) { for (regnum = SPARC_F0_REGNUM, addr = mcontext_addr + 32 * 8; regnum <= SPARC_F31_REGNUM; regnum++, addr += 4) cache->saved_regs[regnum].addr = addr; for (regnum = SPARC64_F32_REGNUM; regnum <= SPARC64_F62_REGNUM; regnum++, addr += 8) cache->saved_regs[regnum].addr = addr; } return cache; }