crt0.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * uC-libc/sysdeps/linux/powerpc/crt0.S
  3. * process init code for powerpc
  4. *
  5. * Copyright (C) 2001 by Lineo, Inc.
  6. * Author: David A. Schleef <ds@schleef.org>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU Library General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  16. * for more details.
  17. *
  18. * You should have received a copy of the GNU Library General Public License
  19. * along with this program; if not, write to the Free Software Foundation,
  20. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. /*
  24. _start is called with the following registers initialized:
  25. r1 null stack frame
  26. r3 argc
  27. r4 argv
  28. r5 envp
  29. r6 auxiliary vector. ignored.
  30. r7 function pointer to jump to when main() exits. If
  31. this is non-zero, it should be registered with atexit().
  32. Linux always (?) sets r7 to NULL, so it is not implemented
  33. here.
  34. */
  35. .text
  36. .global _start
  37. .global __uClibc_main
  38. .type _start,%function
  39. .type __uClibc_main,%function
  40. _start:
  41. /* create 2 empty stack frames */
  42. stwu 1,-32(1)
  43. lwz 3,32(1)
  44. addi 4,1,36
  45. addi 5,1,40
  46. rlwinm 0,3,2,0,29
  47. add 5,5,0
  48. bl __uClibc_main
  49. /* a little bit of stuff to support C++ */
  50. .section .ctors,"aw"
  51. .align 4
  52. .global __CTOR_LIST__
  53. __CTOR_LIST__:
  54. .long -1
  55. .section .dtors,"aw"
  56. .align 4
  57. .global __DTOR_LIST__
  58. __DTOR_LIST__:
  59. .long -1