sigcontext.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 "uml-config.h"
  8. #include <sysdep/sc.h>
  9. #define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
  10. #define SC_RESTART_SYSCALL(sc) IP_RESTART_SYSCALL(SC_IP(sc))
  11. #define SC_SET_SYSCALL_RETURN(sc, result) SC_EAX(sc) = (result)
  12. #define GET_FAULTINFO_FROM_SC(fi,sc) \
  13. { \
  14. (fi).cr2 = SC_CR2(sc); \
  15. (fi).error_code = SC_ERR(sc); \
  16. (fi).trap_no = SC_TRAPNO(sc); \
  17. }
  18. /* ptrace expects that, at the start of a system call, %eax contains
  19. * -ENOSYS, so this makes it so.
  20. */
  21. #define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0)
  22. /* This is Page Fault */
  23. #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
  24. /* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */
  25. #ifdef UML_CONFIG_MODE_SKAS
  26. #define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo)
  27. #else
  28. #define SEGV_MAYBE_FIXABLE(fi) 0
  29. #endif
  30. extern unsigned long *sc_sigmask(void *sc_ptr);
  31. extern int sc_get_fpregs(unsigned long buf, void *sc_ptr);
  32. #endif
  33. /*
  34. * Overrides for Emacs so that we follow Linus's tabbing style.
  35. * Emacs will notice this stuff at the end of the file and automatically
  36. * adjust the settings for this buffer only. This must remain at the end
  37. * of the file.
  38. * ---------------------------------------------------------------------------
  39. * Local variables:
  40. * c-file-style: "linux"
  41. * End:
  42. */