crt1.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* vi: set sw=4 ts=4: */
  2. /* uClibc/sysdeps/linux/m68k/crt0.S
  3. * Pull stuff off the stack and get uClibc moving.
  4. *
  5. * Copyright (C) 2002-2003, George Thanos <george.thanos@gdt.gr>
  6. * Yannis Mitsos <yannis.mitsos@gdt.gr>
  7. *
  8. * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU Library General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  18. * for more details.
  19. *
  20. * You should have received a copy of the GNU Library General Public License
  21. * along with this program; if not, write to the Free Software Foundation,
  22. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. */
  24. /* Stick in a dummy reference to main(), so that if an application
  25. * is linking when the main() function is in a static library (.a)
  26. * we can be sure that main() actually gets linked in */
  27. extern void main(int argc,void *argv,void *envp);
  28. //void (*mainp)(int argc,void *argv,void *envp) = main;
  29. void __uClibc_main(int argc,void *argv,void *envp);
  30. void _uClibc_start(unsigned int first_arg)
  31. {
  32. unsigned int argc;
  33. char **argv, **envp;
  34. unsigned long *stack;
  35. stack = (unsigned long*) first_arg;
  36. argc = *(stack);
  37. argv = (char **)(stack + 1);
  38. envp = (char **)(stack + 1 + argc + 1);
  39. __uClibc_main(argc, argv, envp);
  40. }
  41. void __main() { }