entry-header.S 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include <linux/config.h>
  2. #include <linux/init.h>
  3. #include <linux/linkage.h>
  4. #include <asm/assembler.h>
  5. #include <asm/asm-offsets.h>
  6. #include <asm/errno.h>
  7. #include <asm/thread_info.h>
  8. @ Bad Abort numbers
  9. @ -----------------
  10. @
  11. #define BAD_PREFETCH 0
  12. #define BAD_DATA 1
  13. #define BAD_ADDREXCPTN 2
  14. #define BAD_IRQ 3
  15. #define BAD_UNDEFINSTR 4
  16. @
  17. @ Most of the stack format comes from struct pt_regs, but with
  18. @ the addition of 8 bytes for storing syscall args 5 and 6.
  19. @ This _must_ remain a multiple of 8 for EABI.
  20. @
  21. #define S_OFF 8
  22. /*
  23. * The SWI code relies on the fact that R0 is at the bottom of the stack
  24. * (due to slow/fast restore user regs).
  25. */
  26. #if S_R0 != 0
  27. #error "Please fix"
  28. #endif
  29. .macro zero_fp
  30. #ifdef CONFIG_FRAME_POINTER
  31. mov fp, #0
  32. #endif
  33. .endm
  34. #if __LINUX_ARM_ARCH__ >= 6
  35. .macro disable_irq
  36. cpsid i
  37. .endm
  38. .macro enable_irq
  39. cpsie i
  40. .endm
  41. #else
  42. .macro disable_irq
  43. msr cpsr_c, #PSR_I_BIT | SVC_MODE
  44. .endm
  45. .macro enable_irq
  46. msr cpsr_c, #SVC_MODE
  47. .endm
  48. #endif
  49. .macro get_thread_info, rd
  50. mov \rd, sp, lsr #13
  51. mov \rd, \rd, lsl #13
  52. .endm
  53. .macro alignment_trap, rtemp
  54. #ifdef CONFIG_ALIGNMENT_TRAP
  55. ldr \rtemp, .LCcralign
  56. ldr \rtemp, [\rtemp]
  57. mcr p15, 0, \rtemp, c1, c0
  58. #endif
  59. .endm
  60. /*
  61. * These are the registers used in the syscall handler, and allow us to
  62. * have in theory up to 7 arguments to a function - r0 to r6.
  63. *
  64. * r7 is reserved for the system call number for thumb mode.
  65. *
  66. * Note that tbl == why is intentional.
  67. *
  68. * We must set at least "tsk" and "why" when calling ret_with_reschedule.
  69. */
  70. scno .req r7 @ syscall number
  71. tbl .req r8 @ syscall table pointer
  72. why .req r8 @ Linux syscall (!= 0)
  73. tsk .req r9 @ current thread_info