cprt0.as 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. lis 11,operatingsystem_parameter_argc@ha
  30. stw 3,operatingsystem_parameter_argc@l(11);
  31. lis 11,operatingsystem_parameter_argv@ha
  32. stw 4,operatingsystem_parameter_argv@l(11);
  33. lis 11,operatingsystem_parameter_envp@ha
  34. stw 5,operatingsystem_parameter_envp@l(11);
  35. /* init libc, parameters are already setup at this point */
  36. bl __libc_init_first
  37. /* install finalization code handler */
  38. lis 3,_fini@ha
  39. addi 3,3,_fini@l
  40. bl PASCALMAIN
  41. .globl _haltproc
  42. .type _haltproc,@function
  43. _haltproc:
  44. li 0,1 /* exit call */
  45. lis 3,operatingsystem_result@h
  46. stw 3,operatingsystem_result@l(3)
  47. sc
  48. b _haltproc
  49. /* Define a symbol for the first piece of initialized data. */
  50. .section ".data"
  51. .globl __data_start
  52. __data_start:
  53. data_start:
  54. .globl ___fpc_brk_addr /* heap management */
  55. .type ___fpc_brk_addr,@object
  56. .size ___fpc_brk_addr,4
  57. ___fpc_brk_addr:
  58. .long 0
  59. .text
  60. .comm operatingsystem_parameter_envp,4
  61. .comm operatingsystem_parameter_argc,4
  62. .comm operatingsystem_parameter_argv,4
  63. /*
  64. $Log$
  65. Revision 1.9 2004-09-02 18:57:37 marco
  66. * fixed argc<->argv
  67. Revision 1.8 2004/08/18 14:26:50 karoly
  68. * quick fix to make it compile
  69. Revision 1.7 2004/07/03 21:50:31 daniel
  70. * Modified bootstrap code so separate prt0.as/prt0_10.as files are no
  71. longer necessary
  72. Revision 1.6 2004/01/04 17:28:03 florian
  73. * clean up
  74. Revision 1.5 2004/01/04 17:12:28 florian
  75. * arg* and envp handling fixed
  76. Revision 1.4 2003/12/28 20:08:53 florian
  77. * initial code
  78. Revision 1.3 2002/09/07 16:01:20 peter
  79. * old logs removed and tabs fixed
  80. Revision 1.2 2002/07/26 17:09:44 florian
  81. * log fixed
  82. Revision 1.1 2002/07/26 17:07:11 florian
  83. + dummy implementation to test the makefile
  84. */