prt0.as 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Startup code for programs linked with GNU libc.
  2. Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. .section ".text"
  17. .globl _start
  18. _start:
  19. mr 26,1
  20. /* Set up an initial stack frame, and clear the LR. */
  21. clrrwi 1,1,4
  22. li 0,0
  23. stwu 1,-16(1)
  24. mtlr 0
  25. stw 0,0(1)
  26. lwz 3,0(26) /* get argc */
  27. lis 11,operatingsystem_parameter_argc@ha
  28. stw 3,operatingsystem_parameter_argc@l(11);
  29. addi 4,26,4 /* get argv */
  30. lis 11,operatingsystem_parameter_argv@ha
  31. stw 4,operatingsystem_parameter_argv@l(11);
  32. addi 27,3,1 /* calculate argc + 1 into r27 */
  33. slwi 27,27,2 /* calculate (argc + 1) * sizeof(char *) into r27 */
  34. add 5,4,27 /* get address of env[0] */
  35. lis 11,operatingsystem_parameter_envp@ha
  36. stw 5,operatingsystem_parameter_envp@l(11);
  37. lis 11,__stkptr@ha
  38. stw 1,__stkptr@l(11);
  39. bl PASCALMAIN
  40. b _haltproc
  41. .globl _haltproc
  42. .type _haltproc,@function
  43. _haltproc:
  44. li 0,1 /* exit call */
  45. sc
  46. b _haltproc
  47. /* Define a symbol for the first piece of initialized data. */
  48. .section ".data"
  49. .globl __data_start
  50. __data_start:
  51. data_start:
  52. .text
  53. .comm __stkptr,4
  54. .comm operatingsystem_parameter_envp,4
  55. .comm operatingsystem_parameter_argc,4
  56. .comm operatingsystem_parameter_argv,4