prt0.as 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. $Id$
  3. */
  4. /* Startup code for programs linked with GNU libc.
  5. Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
  6. This file is part of the GNU C Library.
  7. The GNU C Library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. The GNU C Library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with the GNU C Library; if not, write to the Free
  17. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18. 02111-1307 USA. */
  19. .section ".text"
  20. .globl _start
  21. _start:
  22. mr 26,1
  23. /* Set up an initial stack frame, and clear the LR. */
  24. clrrwi 1,1,4
  25. li 0,0
  26. stwu 1,-16(1)
  27. mtlr 0
  28. stw 0,0(1)
  29. lwz 3,0(26) /* get argc */
  30. lis 11,operatingsystem_parameter_argc@ha
  31. stw 3,operatingsystem_parameter_argc@l(11);
  32. addi 4,26,4 /* get argv */
  33. lis 11,operatingsystem_parameter_argv@ha
  34. stw 4,operatingsystem_parameter_argv@l(11);
  35. addi 27,3,1 /* calculate argc + 1 into r27 */
  36. slwi 27,27,2 /* calculate (argc + 1) * sizeof(char *) into r27 */
  37. add 5,4,27 /* get address of env[0] */
  38. lis 11,operatingsystem_parameter_envp@ha
  39. stw 5,operatingsystem_parameter_envp@l(11);
  40. bl PASCALMAIN
  41. b _haltproc
  42. .globl _haltproc
  43. .type _haltproc,@function
  44. _haltproc:
  45. li 0,1 /* exit call */
  46. sc
  47. b _haltproc
  48. /* Define a symbol for the first piece of initialized data. */
  49. .section ".data"
  50. .globl __data_start
  51. __data_start:
  52. data_start:
  53. .globl ___fpc_brk_addr /* heap management */
  54. .type ___fpc_brk_addr,@object
  55. .size ___fpc_brk_addr,4
  56. ___fpc_brk_addr:
  57. .long 0
  58. .bss
  59. .comm operatingsystem_parameter_envp,4
  60. .comm operatingsystem_parameter_argc,4
  61. .comm operatingsystem_parameter_argv,4
  62. /*
  63. $Log$
  64. Revision 1.13 2004-07-03 21:50:31 daniel
  65. * Modified bootstrap code so separate prt0.as/prt0_10.as files are no
  66. longer necessary
  67. Revision 1.12 2004/05/26 20:48:17 florian
  68. * _haltproc fixed
  69. Revision 1.11 2004/01/04 17:23:57 florian
  70. + header added
  71. Revision 1.10 2003/05/12 22:36:45 florian
  72. + added setup of argv, argc and envp
  73. Revision 1.9 2002/09/07 16:01:20 peter
  74. * old logs removed and tabs fixed
  75. Revision 1.8 2002/08/31 21:29:57 florian
  76. * several PC related fixes
  77. Revision 1.7 2002/08/31 16:13:12 florian
  78. * made _start global
  79. Revision 1.6 2002/08/31 14:02:23 florian
  80. * r3 renamed to 3
  81. Revision 1.5 2002/08/31 14:01:28 florian
  82. * _haltproc to prt0.as added (Linux/PPC)
  83. Revision 1.4 2002/08/31 13:11:11 florian
  84. * several fixes for Linux/PPC compilation
  85. Revision 1.3 2002/08/19 21:19:15 florian
  86. * small fixes
  87. Revision 1.2 2002/07/26 17:09:44 florian
  88. * log fixed
  89. Revision 1.1 2002/07/26 16:57:40 florian
  90. + initial version, plain copy from glibc/sysdeps/powerpc/elf/start.S
  91. */