assembler.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * linux/asm/assembler.h
  3. *
  4. * This file contains arm architecture specific defines
  5. * for the different processors.
  6. *
  7. * Do not include any C declarations in this file - it is included by
  8. * assembler source.
  9. */
  10. #ifndef __ASSEMBLY__
  11. #error "Only include this from assembly code"
  12. #endif
  13. /*
  14. * Endian independent macros for shifting bytes within registers.
  15. */
  16. #define pull lsr
  17. #define push lsl
  18. #define byte(x) (x*8)
  19. #ifdef __STDC__
  20. #define LOADREGS(cond, base, reglist...)\
  21. ldm##cond base,reglist^
  22. #define RETINSTR(instr, regs...)\
  23. instr##s regs
  24. #else
  25. #define LOADREGS(cond, base, reglist...)\
  26. ldm/**/cond base,reglist^
  27. #define RETINSTR(instr, regs...)\
  28. instr/**/s regs
  29. #endif
  30. #define MODENOP\
  31. mov r0, r0
  32. #define MODE(savereg,tmpreg,mode) \
  33. mov savereg, pc; \
  34. bic tmpreg, savereg, $0x0c000003; \
  35. orr tmpreg, tmpreg, $mode; \
  36. teqp tmpreg, $0
  37. #define RESTOREMODE(savereg) \
  38. teqp savereg, $0
  39. #define SAVEIRQS(tmpreg)
  40. #define RESTOREIRQS(tmpreg)
  41. #define DISABLEIRQS(tmpreg)\
  42. teqp pc, $0x08000003
  43. #define ENABLEIRQS(tmpreg)\
  44. teqp pc, $0x00000003
  45. #define USERMODE(tmpreg)\
  46. teqp pc, $0x00000000;\
  47. mov r0, r0
  48. #define SVCMODE(tmpreg)\
  49. teqp pc, $0x00000003;\
  50. mov r0, r0
  51. /*
  52. * Save the current IRQ state and disable IRQs
  53. * Note that this macro assumes FIQs are enabled, and
  54. * that the processor is in SVC mode.
  55. */
  56. .macro save_and_disable_irqs, oldcpsr, temp
  57. mov \oldcpsr, pc
  58. orr \temp, \oldcpsr, #0x08000000
  59. teqp \temp, #0
  60. .endm
  61. /*
  62. * Restore interrupt state previously stored in
  63. * a register
  64. * ** Actually do nothing on Arc - hope that the caller uses a MOVS PC soon
  65. * after!
  66. */
  67. .macro restore_irqs, oldcpsr
  68. @ This be restore_irqs
  69. .endm
  70. /*
  71. * These two are used to save LR/restore PC over a user-based access.
  72. * The old 26-bit architecture requires that we save lr (R14)
  73. */
  74. .macro save_lr
  75. str lr, [sp, #-4]!
  76. .endm
  77. .macro restore_pc
  78. ldmfd sp!, {pc}^
  79. .endm
  80. #define USER(x...) \
  81. 9999: x; \
  82. .section __ex_table,"a"; \
  83. .align 3; \
  84. .long 9999b,9001f; \
  85. .previous