static void i386_linux_collect_xstateregset (const struct regset *regset, const struct regcache *regcache, int regnum, void *xstateregs, size_t len) { i387_collect_xsave (regcache, regnum, xstateregs, 1); }
static int store_xstateregs (const struct regcache *regcache, int tid, int regno) { char xstateregs[X86_XSTATE_MAX_SIZE]; struct iovec iov; if (!have_ptrace_getregset) return 0; iov.iov_base = xstateregs; iov.iov_len = sizeof(xstateregs); if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, &iov) < 0) perror_with_name (_("Couldn't read extended state status")); i387_collect_xsave (regcache, regno, xstateregs, 0); if (ptrace (PTRACE_SETREGSET, tid, (unsigned int) NT_X86_XSTATE, (int) &iov) < 0) perror_with_name (_("Couldn't write extended state status")); return 1; }
static void i386bsd_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { if (regnum == -1 || GETREGS_SUPPLIES (regnum)) { struct reg regs; if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) perror_with_name (_("Couldn't get registers")); i386bsd_collect_gregset (regcache, ®s, regnum); if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, ptid_get_lwp (inferior_ptid)) == -1) perror_with_name (_("Couldn't write registers")); if (regnum != -1) return; } if (regnum == -1 || regnum >= I386_ST0_REGNUM) { struct fpreg fpregs; #ifdef HAVE_PT_GETXMMREGS char xmmregs[512]; #endif #ifdef PT_GETXSTATE_INFO if (x86bsd_xsave_len != 0) { void *xstateregs; xstateregs = alloca (x86bsd_xsave_len); if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid), (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) perror_with_name (_("Couldn't get extended state status")); i387_collect_xsave (regcache, -1, xstateregs, 0); if (ptrace (PT_SETXSTATE, get_ptrace_pid (inferior_ptid), (PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1) perror_with_name (_("Couldn't write extended state status")); return; } #endif #ifdef HAVE_PT_GETXMMREGS if (have_ptrace_xmmregs != 0 && ptrace(PT_GETXMMREGS, get_ptrace_pid (inferior_ptid), (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == 0) { have_ptrace_xmmregs = 1; i387_collect_fxsave (regcache, regnum, xmmregs); if (ptrace (PT_SETXMMREGS, get_ptrace_pid (inferior_ptid), (PTRACE_TYPE_ARG3) xmmregs, ptid_get_lwp (inferior_ptid)) == -1) perror_with_name (_("Couldn't write XMM registers")); } else { have_ptrace_xmmregs = 0; #endif if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) perror_with_name (_("Couldn't get floating point status")); i387_collect_fsave (regcache, regnum, &fpregs); if (ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1) perror_with_name (_("Couldn't write floating point status")); #ifdef HAVE_PT_GETXMMREGS } #endif } }