asm-offsets.c 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Generate definitions needed by assembly language modules.
  3. * This code generates raw asm output which is post-processed
  4. * to extract and format the required data.
  5. */
  6. #include <linux/sched.h>
  7. #include <linux/signal.h>
  8. #include <linux/personality.h>
  9. #include <linux/kbuild.h>
  10. #include <asm/registers.h>
  11. #include <asm/ucontext.h>
  12. #include <asm/processor.h>
  13. #include <asm/thread_info.h>
  14. #include <asm/gdb-stub.h>
  15. #define DEF_PTREG(sym, reg) OFFSET(sym, pt_regs, reg)
  16. #define DEF_IREG(sym, reg) OFFSET(sym, user_context, reg)
  17. #define DEF_FREG(sym, reg) OFFSET(sym, user_context, reg)
  18. #define DEF_0REG(sym, reg) OFFSET(sym, frv_frame0, reg)
  19. void foo(void)
  20. {
  21. /* offsets into the thread_info structure */
  22. OFFSET(TI_TASK, thread_info, task);
  23. OFFSET(TI_FLAGS, thread_info, flags);
  24. OFFSET(TI_STATUS, thread_info, status);
  25. OFFSET(TI_CPU, thread_info, cpu);
  26. OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count);
  27. OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
  28. BLANK();
  29. /* offsets into register file storage */
  30. DEF_PTREG(REG_PSR, psr);
  31. DEF_PTREG(REG_ISR, isr);
  32. DEF_PTREG(REG_CCR, ccr);
  33. DEF_PTREG(REG_CCCR, cccr);
  34. DEF_PTREG(REG_LR, lr);
  35. DEF_PTREG(REG_LCR, lcr);
  36. DEF_PTREG(REG_PC, pc);
  37. DEF_PTREG(REG__STATUS, __status);
  38. DEF_PTREG(REG_SYSCALLNO, syscallno);
  39. DEF_PTREG(REG_ORIG_GR8, orig_gr8);
  40. DEF_PTREG(REG_GNER0, gner0);
  41. DEF_PTREG(REG_GNER1, gner1);
  42. DEF_PTREG(REG_IACC0, iacc0);
  43. DEF_PTREG(REG_TBR, tbr);
  44. DEF_PTREG(REG_GR0, tbr);
  45. DEFINE(REG__END, sizeof(struct pt_regs));
  46. BLANK();
  47. DEF_0REG(REG_DCR, debug.dcr);
  48. DEF_0REG(REG_IBAR0, debug.ibar[0]);
  49. DEF_0REG(REG_DBAR0, debug.dbar[0]);
  50. DEF_0REG(REG_DBDR00, debug.dbdr[0][0]);
  51. DEF_0REG(REG_DBMR00, debug.dbmr[0][0]);
  52. BLANK();
  53. DEF_IREG(__INT_GR0, i.gr[0]);
  54. DEF_FREG(__USER_FPMEDIA, f);
  55. DEF_FREG(__FPMEDIA_FR0, f.fr[0]);
  56. DEF_FREG(__FPMEDIA_FNER0, f.fner[0]);
  57. DEF_FREG(__FPMEDIA_MSR0, f.msr[0]);
  58. DEF_FREG(__FPMEDIA_ACC0, f.acc[0]);
  59. DEF_FREG(__FPMEDIA_ACCG0, f.accg[0]);
  60. DEF_FREG(__FPMEDIA_FSR0, f.fsr[0]);
  61. BLANK();
  62. DEFINE(NR_PT_REGS, sizeof(struct pt_regs) / 4);
  63. DEFINE(NR_USER_INT_REGS, sizeof(struct user_int_regs) / 4);
  64. DEFINE(NR_USER_FPMEDIA_REGS, sizeof(struct user_fpmedia_regs) / 4);
  65. DEFINE(NR_USER_CONTEXT, sizeof(struct user_context) / 4);
  66. DEFINE(FRV_FRAME0_SIZE, sizeof(struct frv_frame0));
  67. BLANK();
  68. /* offsets into thread_struct */
  69. OFFSET(__THREAD_FRAME, thread_struct, frame);
  70. OFFSET(__THREAD_CURR, thread_struct, curr);
  71. OFFSET(__THREAD_SP, thread_struct, sp);
  72. OFFSET(__THREAD_FP, thread_struct, fp);
  73. OFFSET(__THREAD_LR, thread_struct, lr);
  74. OFFSET(__THREAD_PC, thread_struct, pc);
  75. OFFSET(__THREAD_GR16, thread_struct, gr[0]);
  76. OFFSET(__THREAD_SCHED_LR, thread_struct, sched_lr);
  77. OFFSET(__THREAD_FRAME0, thread_struct, frame0);
  78. OFFSET(__THREAD_USER, thread_struct, user);
  79. BLANK();
  80. /* offsets into frv_debug_status */
  81. OFFSET(DEBUG_BPSR, frv_debug_status, bpsr);
  82. OFFSET(DEBUG_DCR, frv_debug_status, dcr);
  83. OFFSET(DEBUG_BRR, frv_debug_status, brr);
  84. OFFSET(DEBUG_NMAR, frv_debug_status, nmar);
  85. BLANK();
  86. }