crt0.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* vi: set sw=4 ts=4: */
  2. /* uClibc/sysdeps/linux/i386/crt0.S
  3. * Pull stuff off the stack and get uClibc moving.
  4. *
  5. * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Library General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  15. * for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public License
  18. * along with this program; if not, write to the Free Software Foundation,
  19. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. extern void __uClibc_main(int argc,void *argv,void *envp);
  22. void _start(unsigned int first_arg)
  23. {
  24. unsigned int argc;
  25. char **argv, **envp;
  26. unsigned long *stack;
  27. stack = (unsigned long*) &first_arg;
  28. argc = *(stack - 1);
  29. argv = (char **) stack;
  30. envp = (char **)stack + argc + 1;
  31. __uClibc_main(argc, argv, envp);
  32. }