prelude.as 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #
  2. # $Id$
  3. # This file is part of the Free Pascal run time library.
  4. # Copyright (c) 1999-2002 by the Free Pascal development team
  5. # Copyright (c) 2002 Armin Diehl
  6. #
  7. # This is the (prelude-like) startup code for netware before 4.11
  8. #
  9. # See the file COPYING.FPC, included in this distribution,
  10. # for details about the copyright.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. #
  16. #**********************************************************************
  17. .file "nwpre.as"
  18. .text
  19. #
  20. # This is the main program (not loader) Entry-Point that will be called by netware
  21. # it sets up the argc and argv and calls _nlm_main (in system.pp)
  22. # This version uses the old _SetupArgv and not the newer _SetupArvV_411
  23. #
  24. _pasStart_:
  25. pushl $_nlm_main
  26. call _SetupArgv
  27. addl $4,%esp
  28. ret
  29. #
  30. # this will be called by the loader, we pass the address of _pasStart_ and
  31. # _NLMID (needed by clib) and netware is doing the work
  32. #
  33. .globl _Prelude
  34. _Prelude:
  35. pushl %ebp
  36. movl %esp,%ebp
  37. pushl %edi
  38. pushl %esi
  39. pushl %ebx
  40. movl 0x14(%ebp),%edi
  41. movl 0x18(%ebp),%esi
  42. movl 0x1c(%ebp),%ebx
  43. movl 0x20(%ebp),%ecx
  44. movl 0x28(%ebp),%eax
  45. pushl $_pasStart_
  46. pushl $_NLMID
  47. pushl %eax
  48. movl 0x24(%ebp),%edx
  49. pushl %edx
  50. pushl %ecx
  51. pushl %ebx
  52. pushl %esi
  53. pushl %edi
  54. movl 0x10(%ebp),%edx
  55. pushl %edx
  56. movl 0xc(%ebp),%edx
  57. pushl %edx
  58. movl 0x8(%ebp),%edx
  59. pushl %edx
  60. call _StartNLM
  61. test %eax,%eax
  62. jne x1
  63. xorl %eax,%eax # dont know why this is needed ?
  64. x1:
  65. lea 0xfffffff4(%ebp),%esp
  66. popl %ebx
  67. popl %esi
  68. popl %edi
  69. movl %ebp,%esp
  70. popl %ebp
  71. ret
  72. #
  73. # the global stop-function
  74. #
  75. .globl _Stop
  76. _Stop:
  77. pushl $0x5 # TERMINATE_BY_UNLOAD=0, TERMINATE_BY_EXTERNAL_THREAD=0
  78. pushl $0x0
  79. movl _NLMID,%edx
  80. pushl %edx
  81. call _TerminateNLM
  82. addl $0x0c,%esp
  83. ret
  84. .data
  85. # argc is defined in the novell prelude, i assume it is not needed
  86. #_argc:
  87. # .long 0
  88. _NLMID:
  89. .long 0