ptrace_user.c 903 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 "user.h"
  14. #include "os.h"
  15. #include "uml-config.h"
  16. int ptrace_getregs(long pid, unsigned long *regs_out)
  17. {
  18. if (ptrace(PTRACE_GETREGS, pid, 0, regs_out) < 0)
  19. return -errno;
  20. return 0;
  21. }
  22. int ptrace_setregs(long pid, unsigned long *regs)
  23. {
  24. if (ptrace(PTRACE_SETREGS, pid, 0, regs) < 0)
  25. return -errno;
  26. return 0;
  27. }
  28. int ptrace_getfpregs(long pid, unsigned long *regs)
  29. {
  30. if (ptrace(PTRACE_GETFPREGS, pid, 0, regs) < 0)
  31. return -errno;
  32. return 0;
  33. }
  34. int ptrace_setfpregs(long pid, unsigned long *regs)
  35. {
  36. if (ptrace(PTRACE_SETFPREGS, pid, 0, regs) < 0)
  37. return -errno;
  38. return 0;
  39. }