Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / um / os-Linux / sys-x86_64 / registers.c
blob24c75d00d34144074389c488391a414cd25a54e1
1 /*
2 * Copyright (C) 2006 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
6 #include <errno.h>
7 #include <sys/ptrace.h>
8 #define __FRAME_OFFSETS
9 #include <asm/ptrace.h>
10 #include "kern_constants.h"
11 #include "longjmp.h"
12 #include "user.h"
14 int save_fp_registers(int pid, unsigned long *fp_regs)
16 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
17 return -errno;
18 return 0;
21 int restore_fp_registers(int pid, unsigned long *fp_regs)
23 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
24 return -errno;
25 return 0;
28 unsigned long get_thread_reg(int reg, jmp_buf *buf)
30 switch (reg) {
31 case RIP:
32 return buf[0]->__rip;
33 case RSP:
34 return buf[0]->__rsp;
35 case RBP:
36 return buf[0]->__rbp;
37 default:
38 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
39 reg);
40 return 0;
43 <<<<<<< HEAD:arch/um/os-Linux/sys-x86_64/registers.c
44 =======
46 int get_fp_registers(int pid, unsigned long *regs)
48 return save_fp_registers(pid, regs);
51 int put_fp_registers(int pid, unsigned long *regs)
53 return restore_fp_registers(pid, regs);
55 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/um/os-Linux/sys-x86_64/registers.c