sigcontext.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __SYS_SIGCONTEXT_PPC_H
  6. #define __SYS_SIGCONTEXT_PPC_H
  7. #define DSISR_WRITE 0x02000000
  8. #define SC_FAULT_ADDR(sc) ({ \
  9. struct sigcontext *_sc = (sc); \
  10. long retval = -1; \
  11. switch (_sc->regs->trap) { \
  12. case 0x300: \
  13. /* data exception */ \
  14. retval = _sc->regs->dar; \
  15. break; \
  16. case 0x400: \
  17. /* instruction exception */ \
  18. retval = _sc->regs->nip; \
  19. break; \
  20. default: \
  21. panic("SC_FAULT_ADDR: unhandled trap type\n"); \
  22. } \
  23. retval; \
  24. })
  25. #define SC_FAULT_WRITE(sc) ({ \
  26. struct sigcontext *_sc = (sc); \
  27. long retval = -1; \
  28. switch (_sc->regs->trap) { \
  29. case 0x300: \
  30. /* data exception */ \
  31. retval = !!(_sc->regs->dsisr & DSISR_WRITE); \
  32. break; \
  33. case 0x400: \
  34. /* instruction exception: not a write */ \
  35. retval = 0; \
  36. break; \
  37. default: \
  38. panic("SC_FAULT_ADDR: unhandled trap type\n"); \
  39. } \
  40. retval; \
  41. })
  42. #define SC_IP(sc) ((sc)->regs->nip)
  43. #define SC_SP(sc) ((sc)->regs->gpr[1])
  44. #define SEGV_IS_FIXABLE(sc) (1)
  45. #endif