entry-header.S 1.6 KB

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