crt1.S 1.0 KB

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