2 * Copyright (C) 2004 PathScale, Inc
3 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
9 #include <sys/ptrace.h>
14 #include <sysdep/ptrace_user.h>
16 #include <asm/sigcontext.h>
17 #include <linux/elf.h>
18 #include <registers.h>
21 unsigned long host_fp_size
;
23 int get_fp_registers(int pid
, unsigned long *regs
)
27 .iov_len
= host_fp_size
,
30 if (ptrace(PTRACE_GETREGSET
, pid
, NT_X86_XSTATE
, &iov
) < 0)
35 int put_fp_registers(int pid
, unsigned long *regs
)
39 .iov_len
= host_fp_size
,
42 if (ptrace(PTRACE_SETREGSET
, pid
, NT_X86_XSTATE
, &iov
) < 0)
47 int arch_init_registers(int pid
)
50 /* Just use plenty of space, it does not cost us anything */
51 .iov_len
= 2 * 1024 * 1024,
55 iov
.iov_base
= mmap(NULL
, iov
.iov_len
, PROT_WRITE
| PROT_READ
,
56 MAP_ANONYMOUS
| MAP_PRIVATE
, -1, 0);
57 if (iov
.iov_base
== MAP_FAILED
)
60 /* GDB has x86_xsave_length, which uses x86_cpuid_count */
61 ret
= ptrace(PTRACE_GETREGSET
, pid
, NT_X86_XSTATE
, &iov
);
64 munmap(iov
.iov_base
, 2 * 1024 * 1024);
66 host_fp_size
= iov
.iov_len
;
71 unsigned long get_thread_reg(int reg
, jmp_buf *buf
)
90 printk(UM_KERN_ERR
"get_thread_regs - unknown register %d\n",