Hard code max size. Taken from
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/common/x86-xstate.h

Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
---
 arch/x86/um/os-Linux/registers.c | 9 ++++-----
 arch/x86/um/user-offsets.c       | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/um/os-Linux/registers.c b/arch/x86/um/os-Linux/registers.c
index 00f54a91bb4b..7265511d8e3b 100644
--- a/arch/x86/um/os-Linux/registers.c
+++ b/arch/x86/um/os-Linux/registers.c
@@ -30,7 +30,7 @@ int save_fp_registers(int pid, unsigned long *fp_regs)
 
        if (have_xstate_support) {
                iov.iov_base = fp_regs;
-               iov.iov_len = sizeof(struct _xstate);
+               iov.iov_len = FP_SIZE * sizeof(unsigned long);
                if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) < 0)
                        return -errno;
                return 0;
@@ -49,10 +49,9 @@ int restore_i387_registers(int pid, unsigned long *fp_regs)
 int restore_fp_registers(int pid, unsigned long *fp_regs)
 {
        struct iovec iov;
-
        if (have_xstate_support) {
                iov.iov_base = fp_regs;
-               iov.iov_len = sizeof(struct _xstate);
+               iov.iov_len = FP_SIZE * sizeof(unsigned long);
                if (ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov) < 0)
                        return -errno;
                return 0;
@@ -122,11 +121,11 @@ int put_fp_registers(int pid, unsigned long *regs)
 
 void arch_init_registers(int pid)
 {
-       struct _xstate fp_regs;
+       unsigned long fp_regs[FP_SIZE];
        struct iovec iov;
 
        iov.iov_base = &fp_regs;
-       iov.iov_len = sizeof(struct _xstate);
+       iov.iov_len = FP_SIZE * sizeof(unsigned long);
        if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) == 0)
                have_xstate_support = 1;
 }
diff --git a/arch/x86/um/user-offsets.c b/arch/x86/um/user-offsets.c
index cb3c22370cf5..c0111f093361 100644
--- a/arch/x86/um/user-offsets.c
+++ b/arch/x86/um/user-offsets.c
@@ -50,7 +50,7 @@ void foo(void)
        DEFINE(HOST_GS, GS);
        DEFINE(HOST_ORIG_AX, ORIG_EAX);
 #else
-       DEFINE(HOST_FP_SIZE, sizeof(struct _xstate) / sizeof(unsigned long));
+       DEFINE_LONGS(HOST_FP_SIZE, 2696);
        DEFINE_LONGS(HOST_BX, RBX);
        DEFINE_LONGS(HOST_CX, RCX);
        DEFINE_LONGS(HOST_DI, RDI);
-- 
2.13.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to