crt0.S 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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, write to the Free Software Foundation, Inc., 675 Mass Ave,
  14. Cambridge, MA 02139, USA. */
  15. #include <features.h>
  16. #include <asm/unistd.h>
  17. #include "NM_Macros.S"
  18. #define __ASSEMBLY__
  19. #include <asm/ptrace.h> /* for REGWIN_SZ */
  20. .global _start
  21. .type __start,@function
  22. .weak _init
  23. .weak _fini
  24. .type __uClibc_start_main,@function
  25. .type __h_errno_location, @function
  26. .type _stdio_init, @function
  27. .type _stdio_term, @function
  28. .text
  29. _start:
  30. nop
  31. nop
  32. lds %o0,[%sp, (REGWIN_SZ / 4) + 0] // main's argc
  33. lds %o1,[%sp, (REGWIN_SZ / 4) + 1] // main's argv
  34. lds %o2,[%sp, (REGWIN_SZ / 4) + 2] // main's envp
  35. MOVIA %o3, _init@h
  36. MOVIA %o4, _fini@h
  37. MOVIA %o5, __uClibc_start_main@h
  38. call %o5
  39. nop
  40. /* If that didn't kill us, ... */
  41. __exit:
  42. MOVIP %g1, __NR_exit
  43. trap 63