sigcontext.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __SYS_SIGCONTEXT_I386_H
  6. #define __SYS_SIGCONTEXT_I386_H
  7. #include <sysdep/sc.h>
  8. #define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
  9. #define SC_RESTART_SYSCALL(sc) IP_RESTART_SYSCALL(SC_IP(sc))
  10. #define SC_SET_SYSCALL_RETURN(sc, result) SC_EAX(sc) = (result)
  11. #define SC_FAULT_ADDR(sc) SC_CR2(sc)
  12. #define SC_FAULT_TYPE(sc) SC_ERR(sc)
  13. #define FAULT_WRITE(err) (err & 2)
  14. #define TO_SC_ERR(is_write) ((is_write) ? 2 : 0)
  15. #define SC_FAULT_WRITE(sc) (FAULT_WRITE(SC_ERR(sc)))
  16. #define SC_TRAP_TYPE(sc) SC_TRAPNO(sc)
  17. /* ptrace expects that, at the start of a system call, %eax contains
  18. * -ENOSYS, so this makes it so.
  19. */
  20. #define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0)
  21. /* This is Page Fault */
  22. #define SEGV_IS_FIXABLE(trap) (trap == 14)
  23. #define SC_SEGV_IS_FIXABLE(sc) (SEGV_IS_FIXABLE(SC_TRAPNO(sc)))
  24. extern unsigned long *sc_sigmask(void *sc_ptr);
  25. extern int sc_get_fpregs(unsigned long buf, void *sc_ptr);
  26. #endif
  27. /*
  28. * Overrides for Emacs so that we follow Linus's tabbing style.
  29. * Emacs will notice this stuff at the end of the file and automatically
  30. * adjust the settings for this buffer only. This must remain at the end
  31. * of the file.
  32. * ---------------------------------------------------------------------------
  33. * Local variables:
  34. * c-file-style: "linux"
  35. * End:
  36. */