static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, int write, void *arg) { ucontext_t *uc = arg; unw_fpreg_t *addr; if ((unsigned) (reg - UNW_HPPA_FR) > 32) goto badreg; addr = uc_addr (uc, reg); if (!addr) goto badreg; if (write) { Debug (12, "%s <- %08x.%08x\n", unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); *(unw_fpreg_t *) addr = *val; } else { *val = *(unw_fpreg_t *) addr; Debug (12, "%s -> %08x.%08x\n", unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); } return 0; badreg: Debug (1, "bad register number %u\n", reg); /* attempt to access a non-preserved register */ return -UNW_EBADREG; }
static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, int write, void *arg) { unw_tdep_context_t *uc = arg; unw_fpreg_t *addr; if (!unw_is_fpreg (reg)) goto badreg; if (!(addr = uc_addr (uc, reg))) goto badreg; if (write) { Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); *(unw_fpreg_t *) addr = *val; } else { *val = *(unw_fpreg_t *) addr; Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); } return 0; badreg: Debug (1, "bad register number %u\n", reg); /* attempt to access a non-preserved register */ return -UNW_EBADREG; }
static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, void *arg) { unw_word_t *addr; ucontext_t *uc = arg; if ((unsigned int) (reg - UNW_HPPA_FR) < 32) goto badreg; addr = uc_addr (uc, reg); if (!addr) goto badreg; if (write) { *(unw_word_t *) addr = *val; Debug (12, "%s <- %x\n", unw_regname (reg), *val); } else { *val = *(unw_word_t *) addr; Debug (12, "%s -> %x\n", unw_regname (reg), *val); } return 0; badreg: Debug (1, "bad register number %u\n", reg); return -UNW_EBADREG; }
static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, void *arg) { unw_word_t *addr; unw_tdep_context_t *uc = arg; if (unw_is_fpreg (reg)) goto badreg; if (!(addr = uc_addr (uc, reg))) goto badreg; if (write) { *(unw_word_t *) addr = *val; Debug (12, "%s <- %lx\n", unw_regname (reg), *val); } else { *val = *(unw_word_t *) addr; Debug (12, "%s -> %lx\n", unw_regname (reg), *val); } return 0; badreg: Debug (1, "bad register number %u\n", reg); return -UNW_EBADREG; }
static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, void *arg) { unw_word_t *addr; ucontext_t *uc = arg; if (unw_is_fpreg (reg)) goto badreg; Debug (16, "reg = %s\n", unw_regname (reg)); if (!(addr = uc_addr (uc, reg))) goto badreg; if (write) { *(unw_word_t *) (intptr_t) addr = (mips_reg_t) *val; Debug (12, "%s <- %llx\n", unw_regname (reg), (long long) *val); } else { *val = (mips_reg_t) *(unw_word_t *) (intptr_t) addr; Debug (12, "%s -> %llx\n", unw_regname (reg), (long long) *val); } return 0; badreg: Debug (1, "bad register number %u\n", reg); return -UNW_EBADREG; }
static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, void *arg) { unw_word_t *addr; ucontext_t *uc = arg; if (UNW_PPC64_F0 <= reg && reg <= UNW_PPC64_F31) goto badreg; if (UNW_PPC64_V0 <= reg && reg <= UNW_PPC64_V31) goto badreg; addr = uc_addr (uc, reg); if (!addr) goto badreg; if (write) { *(unw_word_t *) addr = *val; Debug (12, "%s <- %lx\n", unw_regname (reg), *val); } else { *val = *(unw_word_t *) addr; Debug (12, "%s -> %lx\n", unw_regname (reg), *val); } return 0; badreg: Debug (1, "bad register number %u\n", reg); return -UNW_EBADREG; }
HIDDEN void * tdep_uc_addr (ucontext_t *uc, int reg) { char *addr = uc_addr (uc, reg); if (reg >= UNW_MIPS_R0 && reg <= UNW_MIPS_R31 && tdep_big_endian (unw_local_addr_space) && unw_local_addr_space->abi == UNW_MIPS_ABI_O32) addr += 4; return addr; }
void * _Uhppa_uc_addr (ucontext_t *uc, int reg) { return uc_addr (uc, reg); }
HIDDEN void * tdep_uc_addr (unw_tdep_context_t *uc, int reg) { return uc_addr (uc, reg); }