arm_start.S 894 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. .global _start
  2. .global _get_stack_pointer
  3. _start:
  4. ldr sp, =stack_top
  5. sub sp, sp, #0x4
  6. // clear bss segment
  7. ldr r3, =_bss_start - 1 // -1 because of the strltb below
  8. ldr r4, =_bss_end - 1
  9. 1:
  10. cmp r3, r4 // already done?
  11. strltb r0, [r3, #1]! // if not store 0 byte and advance r3
  12. blt 1b // if not repeat
  13. // enable FPU (VFP/NEON)
  14. /*mrc p15, #0, r1, c1, c0, #2
  15. orr r1, r1, #(0xf << 20)
  16. mcr p15, #0, r1, c1, c0, #2
  17. mov r1, #0
  18. mcr p15, #0, r1, c7, c5, #4
  19. mov r0,#0x40000000
  20. fmxr FPEXC, r0*/
  21. // jump to kernel_main
  22. ldr r3, =_cstartup
  23. blx r3
  24. _inf_loop:
  25. b _inf_loop
  26. _get_stack_pointer:
  27. // Return the stack pointer value
  28. str sp, [sp]
  29. ldr r0, [sp]
  30. mov pc, lr
  31. // constants for ldr macro
  32. constants:
  33. .ltorg
  34. .section ".bss"
  35. // 16k stack aligned to 4 byte
  36. .balign 4
  37. .global stack
  38. stack:
  39. .fill 64000, 4, 0
  40. .global stack_top
  41. stack_top: