dllprt0.as 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 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. .globl FPC_SHARED_LIB_EXIT
  43. .type FPC_SHARED_LIB_EXIT,@function
  44. .type _haltproc,@function
  45. FPC_SHARED_LIB_EXIT:
  46. _haltproc:
  47. lis 11,operatingsystem_result@ha
  48. lwz 3,operatingsystem_result@l(3)
  49. li 0,234 /* exit group call */
  50. sc
  51. lis 11,operatingsystem_result@ha
  52. lwz 3,operatingsystem_result@l(3)
  53. li 0,1 /* exit call */
  54. sc
  55. /* we should not reach here. Crash horribly */
  56. trap
  57. /* Define a symbol for the first piece of initialized data. */
  58. .section ".data"
  59. .globl __data_start
  60. __data_start:
  61. data_start:
  62. .section ".bss"
  63. .type __stkptr, @object
  64. .size __stkptr, 4
  65. .global __stkptr
  66. __stkptr:
  67. .skip 4
  68. .type operatingsystem_parameters, @object
  69. .size operatingsystem_parameters, 12
  70. operatingsystem_parameters:
  71. .skip 3 * 4
  72. .global operatingsystem_parameter_argc
  73. .global operatingsystem_parameter_argv
  74. .global operatingsystem_parameter_envp
  75. .set operatingsystem_parameter_argc, operatingsystem_parameters+0
  76. .set operatingsystem_parameter_argv, operatingsystem_parameters+4
  77. .set operatingsystem_parameter_envp, operatingsystem_parameters+8
  78. .section .note.GNU-stack,"",%progbits