crt1.S 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Startup code compliant to the ELF CRIS ABI */
  2. #include <features.h>
  3. .syntax no_register_prefix
  4. /* The first piece of initialized data. */
  5. .data
  6. .global __data_start
  7. .align 2
  8. .type __data_start, @object
  9. .size __data_start, 4
  10. __data_start:
  11. .dword 0
  12. .text
  13. .align 1
  14. .global _start
  15. .type _start, %function
  16. #if defined(__UCLIBC_CTOR_DTOR__)
  17. .type _init, %function
  18. .type _fini, %function
  19. #else
  20. .weak _init
  21. .weak _fini
  22. #endif
  23. .type main, %function
  24. .type __uClibc_main, %function
  25. /*
  26. * On the stack we have argc. We can calculate argv/envp
  27. * from that and the succeeding stack location, but fix so
  28. * we get the right calling convention (regs in r10/r11).
  29. *
  30. * Please view linux/fs/binfmt_elf.c for a complete
  31. * understanding of this.
  32. */
  33. /*
  34. * Need to call __uClibc_main(main, argc, argv, _init, _fini)
  35. */
  36. _start:
  37. move.d main, r10
  38. move.d [sp+], r11
  39. move.d sp, r12
  40. subq 4, sp
  41. move srp, [sp]
  42. subq 4, sp
  43. move.d _fini, r13
  44. move.d r13, [sp]
  45. move.d _init, r13
  46. /* Leave control to the libc */
  47. jsr __uClibc_main
  48. nop
  49. .size _start, .-_start