static int i386nto_regset_fill (int regset, char *data) { if (regset == NTO_REG_GENERAL) { int regno; for (regno = 0; regno < NUM_GPREGS; regno++) { int offset = nto_reg_offset (regno); if (offset != -1) regcache_collect (regno, data + offset); } } else if (regset == NTO_REG_FLOAT) { if (nto_cpuinfo_valid && nto_cpuinfo_flags | X86_CPU_FXSR) i387_fill_fxsave (data, -1); else i387_fill_fsave (data, -1); } else return -1; return 0; }
ps_err_e ps_lgetxmmregs (struct ps_prochandle *ph, lwpid_t lwpid, char *xmmregs) { struct cleanup *old_chain; old_chain = save_inferior_ptid (); inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid)); target_fetch_registers (-1); i387_fill_fxsave (xmmregs, -1); do_cleanups (old_chain); return PS_OK; }
static void fbsd_lwp_store_registers (int regno) { gregset_t gregs; fpregset_t fpregs; lwpid_t lwp; #ifdef PT_GETXMMREGS char xmmregs[512]; #endif /* FIXME, is it possible ? */ if (!IS_LWP (inferior_ptid)) { child_ops.to_store_registers (regno); return ; } lwp = GET_LWP (inferior_ptid); if (regno != -1) if (ptrace (PT_GETREGS, lwp, (caddr_t) &gregs, 0) == -1) error ("Cannot get lwp %d registers: %s\n", lwp, safe_strerror (errno)); fill_gregset (&gregs, regno); if (ptrace (PT_SETREGS, lwp, (caddr_t) &gregs, 0) == -1) error ("Cannot set lwp %d registers: %s\n", lwp, safe_strerror (errno)); #ifdef PT_GETXMMREGS if (regno != -1) if (ptrace (PT_GETXMMREGS, lwp, xmmregs, 0) == -1) goto noxmm; i387_fill_fxsave (xmmregs, regno); if (ptrace (PT_SETXMMREGS, lwp, xmmregs, 0) == -1) goto noxmm; return; noxmm: #endif if (regno != -1) if (ptrace (PT_GETFPREGS, lwp, (caddr_t) &fpregs, 0) == -1) error ("Cannot get lwp %d float registers: %s\n", lwp, safe_strerror (errno)); fill_fpregset (&fpregs, regno); if (ptrace (PT_SETFPREGS, lwp, (caddr_t) &fpregs, 0) == -1) error ("Cannot set lwp %d float registers: %s\n", lwp, safe_strerror (errno)); }
static void fbsd_thread_store_registers (int regno) { prgregset_t gregset; prfpregset_t fpregset; td_thrhandle_t th; td_err_e err; #ifdef PT_GETXMMREGS char xmmregs[512]; #endif if (!IS_THREAD (inferior_ptid)) { fbsd_lwp_store_registers (regno); return; } err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (inferior_ptid), &th); if (err != TD_OK) error ("Cannot find thread %d: Thread ID=%ld, %s", pid_to_thread_id (inferior_ptid), GET_THREAD (inferior_ptid), thread_db_err_str (err)); if (regno != -1) { char old_value[MAX_REGISTER_SIZE]; regcache_collect (regno, old_value); err = td_thr_getgregs_p (&th, gregset); if (err != TD_OK) error ("%s: td_thr_getgregs %s", __func__, thread_db_err_str (err)); #ifdef PT_GETXMMREGS err = td_thr_getxmmregs_p (&th, xmmregs); if (err != TD_OK) { #endif err = td_thr_getfpregs_p (&th, &fpregset); if (err != TD_OK) error ("%s: td_thr_getfpgregs %s", __func__, thread_db_err_str (err)); #ifdef PT_GETXMMREGS } #endif supply_register (regno, old_value); } fill_gregset (gregset, regno); err = td_thr_setgregs_p (&th, gregset); if (err != TD_OK) error ("Cannot store general-purpose registers for thread %d: Thread ID=%d, %s", pid_to_thread_id (inferior_ptid), GET_THREAD (inferior_ptid), thread_db_err_str (err)); #ifdef PT_GETXMMREGS i387_fill_fxsave (xmmregs, regno); err = td_thr_setxmmregs_p (&th, xmmregs); if (err == TD_OK) return; #endif fill_fpregset (&fpregset, regno); err = td_thr_setfpregs_p (&th, &fpregset); if (err != TD_OK) error ("Cannot store floating-point registers for thread %d: Thread ID=%d, %s", pid_to_thread_id (inferior_ptid), GET_THREAD (inferior_ptid), thread_db_err_str (err)); }
void fill_fpxregset (elf_fpxregset_t *fpxregsetp, int regno) { i387_fill_fxsave ((char *) fpxregsetp, regno); }