dllcprt0.as 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. .file "dllcprt0.as"
  2. .data
  3. .align 4
  4. default_environ:
  5. .long 0
  6. .text
  7. .globl initialize_after
  8. .type initialize_after,@function
  9. initialize_after:
  10. .globl FPC_SHARED_LIB_START
  11. .type FPC_SHARED_LIB_START,@function
  12. FPC_SHARED_LIB_START:
  13. /* We are in a library if we link something against this code */
  14. movb $1,operatingsystem_islibrary
  15. /* Initialize freepascal variables in the shared object so they
  16. can be used as expected.
  17. As we link with libroot (our libc), just copy values from the
  18. corresponding external variables in the Freepascal ones.
  19. They are already initialized by libroot initialization.
  20. Inspired by /haiku/src/system/glue/start_dyn.c
  21. and /haiku/src/system/libroot/libroot_init.c
  22. */
  23. movl __libc_argc,%eax
  24. movl %eax,operatingsystem_parameter_argc
  25. movl __libc_argv,%eax
  26. movl %eax,operatingsystem_parameter_argv
  27. movl environ,%eax
  28. movl %eax,operatingsystem_parameter_envp
  29. xorl %ebp,%ebp
  30. call PASCALMAIN
  31. .globl _haltproc
  32. .type _haltproc,@function
  33. _haltproc:
  34. call _thread_do_exit_notification
  35. xorl %ebx,%ebx
  36. movw operatingsystem_result,%bx
  37. pushl %ebx
  38. call exit
  39. .bss
  40. .comm operatingsystem_parameter_envp,4
  41. .comm operatingsystem_parameter_argc,4
  42. .comm operatingsystem_parameter_argv,4