Jeff Dike | 48b2018 | 2007-05-06 14:51:00 -0700 | [diff] [blame] | 1 | /* |
Jeff Dike | 4c9e138 | 2007-10-16 01:26:54 -0700 | [diff] [blame^] | 2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * Licensed under the GPL |
| 4 | */ |
| 5 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #include <errno.h> |
Jeff Dike | 4c9e138 | 2007-10-16 01:26:54 -0700 | [diff] [blame^] | 7 | #include <sys/ptrace.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | |
| 9 | int ptrace_getregs(long pid, unsigned long *regs_out) |
| 10 | { |
| 11 | if (ptrace(PTRACE_GETREGS, pid, 0, regs_out) < 0) |
| 12 | return -errno; |
| 13 | return 0; |
| 14 | } |
| 15 | |
| 16 | int ptrace_setregs(long pid, unsigned long *regs) |
| 17 | { |
| 18 | if (ptrace(PTRACE_SETREGS, pid, 0, regs) < 0) |
| 19 | return -errno; |
| 20 | return 0; |
| 21 | } |
| 22 | |
| 23 | int ptrace_getfpregs(long pid, unsigned long *regs) |
| 24 | { |
| 25 | if (ptrace(PTRACE_GETFPREGS, pid, 0, regs) < 0) |
| 26 | return -errno; |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | int ptrace_setfpregs(long pid, unsigned long *regs) |
| 31 | { |
| 32 | if (ptrace(PTRACE_SETFPREGS, pid, 0, regs) < 0) |
| 33 | return -errno; |
| 34 | return 0; |
| 35 | } |