crt1.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If
  13. not, see <http://www.gnu.org/licenses/>. */
  14. #include <features.h>
  15. #include <asm/unistd.h>
  16. #include "NM_Macros.S"
  17. #define __ASSEMBLY__
  18. #include <asm/ptrace.h> /* for REGWIN_SZ */
  19. .global _start
  20. .type __start,@function
  21. .weak _init
  22. .weak _fini
  23. .type main,@function
  24. .type __uClibc_main,@function
  25. .text
  26. _start:
  27. nop
  28. nop
  29. MOVIA %o0, main@h
  30. lds %o1,[%sp, (REGWIN_SZ / 4) + 0] /* main's argc */
  31. lds %o2,[%sp, (REGWIN_SZ / 4) + 1] /* main's argv */
  32. MOVIA %o3, _init@h
  33. MOVIA %o4, _fini@h
  34. mov %o5, %i0 /* rtld_fini */
  35. mov %o6, %sp /* stack_end */
  36. MOVIA %o7, __uClibc_main@h
  37. call %o7
  38. nop
  39. /* If that didn't kill us, ... */
  40. __exit:
  41. MOVIP %g1, __NR_exit
  42. trap 63