ptrace_user.c 930 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #include <stdio.h>
  6. #include <stddef.h>
  7. #include <errno.h>
  8. #include <unistd.h>
  9. #include "ptrace_user.h"
  10. /* Grr, asm/user.h includes asm/ptrace.h, so has to follow ptrace_user.h */
  11. #include <asm/user.h>
  12. #include "kern_util.h"
  13. #include "sysdep/thread.h"
  14. #include "user.h"
  15. #include "os.h"
  16. #include "uml-config.h"
  17. int ptrace_getregs(long pid, unsigned long *regs_out)
  18. {
  19. if (ptrace(PTRACE_GETREGS, pid, 0, regs_out) < 0)
  20. return -errno;
  21. return 0;
  22. }
  23. int ptrace_setregs(long pid, unsigned long *regs)
  24. {
  25. if (ptrace(PTRACE_SETREGS, pid, 0, regs) < 0)
  26. return -errno;
  27. return 0;
  28. }
  29. int ptrace_getfpregs(long pid, unsigned long *regs)
  30. {
  31. if (ptrace(PTRACE_GETFPREGS, pid, 0, regs) < 0)
  32. return -errno;
  33. return 0;
  34. }
  35. int ptrace_setfpregs(long pid, unsigned long *regs)
  36. {
  37. if (ptrace(PTRACE_SETFPREGS, pid, 0, regs) < 0)
  38. return -errno;
  39. return 0;
  40. }