crt1.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 main,@function
  25. .type __uClibc_main,@function
  26. .text
  27. _start:
  28. nop
  29. nop
  30. MOVIA %o0, main@h
  31. lds %o1,[%sp, (REGWIN_SZ / 4) + 0] /* main's argc */
  32. lds %o2,[%sp, (REGWIN_SZ / 4) + 1] /* main's argv */
  33. MOVIA %o3, _init@h
  34. MOVIA %o4, _fini@h
  35. mov %o5, %i0 /* rtld_fini */
  36. mov %o6, %sp /* stack_end */
  37. MOVIA %o7, __uClibc_main@h
  38. call %o7
  39. nop
  40. /* If that didn't kill us, ... */
  41. __exit:
  42. MOVIP %g1, __NR_exit
  43. trap 63