dllprt0.as 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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., 51 Franklin Street, Fifth Floor, Boston,
  15. MA 02111-1301 USA. */
  16. .section ".text"
  17. .globl FPC_SHARED_LIB_START
  18. .type FPC_SHARED_LIB_START,@function
  19. FPC_SHARED_LIB_START:
  20. mflr 0
  21. stw 0,4(1)
  22. stwu 1,-32(1)
  23. /* store argument count (in r3)*/
  24. lis 11,operatingsystem_parameter_argc@ha
  25. stw 3,operatingsystem_parameter_argc@l(11);
  26. /* store argument vector (in r4) */
  27. lis 11,operatingsystem_parameter_argv@ha
  28. stw 4,operatingsystem_parameter_argv@l(11);
  29. /* store environment pointer (in r5) */
  30. lis 11,operatingsystem_parameter_envp@ha
  31. stw 5,operatingsystem_parameter_envp@l(11);
  32. lis 11,__stkptr@ha
  33. stw 1,__stkptr@l(11);
  34. /* call library initialization */
  35. bl PASCALMAIN
  36. /* return to the caller */
  37. addi 1,1,32
  38. lwz 0,4(1)
  39. mtlr 0
  40. blr
  41. .globl _haltproc
  42. .type _haltproc,@function
  43. _haltproc:
  44. lis 11,operatingsystem_result@ha
  45. lwz 3,operatingsystem_result@l(3)
  46. li 0,234 /* exit group call */
  47. sc
  48. lis 11,operatingsystem_result@ha
  49. lwz 3,operatingsystem_result@l(3)
  50. li 0,1 /* exit call */
  51. sc
  52. /* we should not reach here. Crash horribly */
  53. trap
  54. /* Define a symbol for the first piece of initialized data. */
  55. .section ".data"
  56. .globl __data_start
  57. __data_start:
  58. data_start:
  59. .section ".bss"
  60. .type __stkptr, @object
  61. .size __stkptr, 4
  62. .global __stkptr
  63. __stkptr:
  64. .skip 4
  65. .type operatingsystem_parameters, @object
  66. .size operatingsystem_parameters, 12
  67. operatingsystem_parameters:
  68. .skip 3 * 4
  69. .global operatingsystem_parameter_argc
  70. .global operatingsystem_parameter_argv
  71. .global operatingsystem_parameter_envp
  72. .set operatingsystem_parameter_argc, operatingsystem_parameters+0
  73. .set operatingsystem_parameter_argv, operatingsystem_parameters+4
  74. .set operatingsystem_parameter_envp, operatingsystem_parameters+8
  75. .section .note.GNU-stack,"",%progbits