elf.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef __ASMCRIS_ARCH_ELF_H
  2. #define __ASMCRIS_ARCH_ELF_H
  3. /*
  4. * ELF register definitions..
  5. */
  6. #include <asm/ptrace.h>
  7. /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program
  8. starts (a register; assume first param register for CRIS)
  9. contains a pointer to a function which might be
  10. registered using `atexit'. This provides a mean for the
  11. dynamic linker to call DT_FINI functions for shared libraries
  12. that have been loaded before the code runs.
  13. A value of 0 tells we have no such handler. */
  14. /* Explicitly set registers to 0 to increase determinism. */
  15. #define ELF_PLAT_INIT(_r, load_addr) do { \
  16. (_r)->r13 = 0; (_r)->r12 = 0; (_r)->r11 = 0; (_r)->r10 = 0; \
  17. (_r)->r9 = 0; (_r)->r8 = 0; (_r)->r7 = 0; (_r)->r6 = 0; \
  18. (_r)->r5 = 0; (_r)->r4 = 0; (_r)->r3 = 0; (_r)->r2 = 0; \
  19. (_r)->r1 = 0; (_r)->r0 = 0; (_r)->mof = 0; (_r)->srp = 0; \
  20. } while (0)
  21. /* The additional layer below is because the stack pointer is missing in
  22. the pt_regs struct, but needed in a core dump. pr_reg is a elf_gregset_t,
  23. and should be filled in according to the layout of the user_regs_struct
  24. struct; regs is a pt_regs struct. We dump all registers, though several are
  25. obviously unnecessary. That way there's less need for intelligence at
  26. the receiving end (i.e. gdb). */
  27. #define ELF_CORE_COPY_REGS(pr_reg, regs) \
  28. pr_reg[0] = regs->r0; \
  29. pr_reg[1] = regs->r1; \
  30. pr_reg[2] = regs->r2; \
  31. pr_reg[3] = regs->r3; \
  32. pr_reg[4] = regs->r4; \
  33. pr_reg[5] = regs->r5; \
  34. pr_reg[6] = regs->r6; \
  35. pr_reg[7] = regs->r7; \
  36. pr_reg[8] = regs->r8; \
  37. pr_reg[9] = regs->r9; \
  38. pr_reg[10] = regs->r10; \
  39. pr_reg[11] = regs->r11; \
  40. pr_reg[12] = regs->r12; \
  41. pr_reg[13] = regs->r13; \
  42. pr_reg[14] = rdusp(); /* sp */ \
  43. pr_reg[15] = regs->irp; /* pc */ \
  44. pr_reg[16] = 0; /* p0 */ \
  45. pr_reg[17] = rdvr(); /* vr */ \
  46. pr_reg[18] = 0; /* p2 */ \
  47. pr_reg[19] = 0; /* p3 */ \
  48. pr_reg[20] = 0; /* p4 */ \
  49. pr_reg[21] = (regs->dccr & 0xffff); /* ccr */ \
  50. pr_reg[22] = 0; /* p6 */ \
  51. pr_reg[23] = regs->mof; /* mof */ \
  52. pr_reg[24] = 0; /* p8 */ \
  53. pr_reg[25] = 0; /* ibr */ \
  54. pr_reg[26] = 0; /* irp */ \
  55. pr_reg[27] = regs->srp; /* srp */ \
  56. pr_reg[28] = 0; /* bar */ \
  57. pr_reg[29] = regs->dccr; /* dccr */ \
  58. pr_reg[30] = 0; /* brp */ \
  59. pr_reg[31] = rdusp(); /* usp */ \
  60. pr_reg[32] = 0; /* csrinstr */ \
  61. pr_reg[33] = 0; /* csraddr */ \
  62. pr_reg[34] = 0; /* csrdata */
  63. #endif