crt0.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #
  2. # clone.S, part of the i960 support for the uClibc library.
  3. #
  4. # Copyright (C) 2002 by Okiok Data Ltd. http://www.okiok.com/
  5. #
  6. # This program is free software; you can redistribute it and/or modify it under
  7. # the terms of the GNU Library General Public License as published by the Free
  8. # Software Foundation; either version 2 of the License, or (at your option) any
  9. # later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but WITHOUT
  12. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  14. # details.
  15. #
  16. # You should have received a copy of the GNU Library General Public License
  17. # along with this program; if not, write to the Free Software Foundation, Inc.,
  18. # at 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. #
  20. /*
  21. *
  22. * The behavior in this file is tightly coupled with how the linux kernel sets things up
  23. * on the stack before calling us.
  24. *
  25. * Currently fs/binfmt_flat.c (for STACK_GROWS_UP) and arch/i960/kernel/process.c
  26. * build things so that a pointer to argc is left in g13 by start_thread().
  27. *
  28. * ^
  29. * | <- sp somewhere around here, after being aligned.
  30. * |
  31. * |envp -> envp[0]
  32. * |argv -> argv[0]
  33. * |argc <- g13
  34. *
  35. * A complete picture of how things are set up can be seen in the comments of
  36. * create_flat_tables_stack_grows_up in fs/binfmt_flat.c
  37. *
  38. * I believe having to use this register could probably be avoided.
  39. *
  40. */
  41. .globl start
  42. start:
  43. mov g13, r3
  44. ldt (r3), g0
  45. callx ___uClibc_main
  46. /* We might want to add some instruction so that it crashes if main returns */