You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

48 lines
1.0 KiB

  1. /* Sample initialization file */
  2. .extern main
  3. .extern exit
  4. /* .text is used instead of .section .text so it works with arm-aout too. */
  5. .text
  6. .code 32
  7. .align 0
  8. .global _mainCRTStartup
  9. .global _start
  10. .global start
  11. start:
  12. _start:
  13. _mainCRTStartup:
  14. /* Start by setting up a stack */
  15. /* Set up the stack pointer to end of bss */
  16. ldr r3, .LC2
  17. mov sp, r3
  18. sub sl, sp, #512 /* Still assumes 512 bytes below sl */
  19. mov a2, #0 /* Second arg: fill value */
  20. mov fp, a2 /* Null frame pointer */
  21. mov r7, a2 /* Null frame pointer for Thumb */
  22. ldr a1, .LC1 /* First arg: start of memory block */
  23. ldr a3, .LC2 /* Second arg: end of memory block */
  24. sub a3, a3, a1 /* Third arg: length of block */
  25. mov r0, #0 /* no arguments */
  26. mov r1, #0 /* no argv either */
  27. bl main
  28. bl exit /* Should not return */
  29. /* For Thumb, constants must be after the code since only
  30. positive offsets are supported for PC relative addresses. */
  31. .align 0
  32. .LC1:
  33. .word __bss_start__
  34. .LC2:
  35. .word __bss_end__