arm_start.S 960 B

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