dllprt0.as 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. Library startup code for Android/MIPS
  3. by Vsevolod Alekseyev
  4. */
  5. .set noat
  6. .section ".text"
  7. .align 4
  8. .global FPC_SHARED_LIB_START
  9. FPC_SHARED_LIB_START:
  10. .ent FPC_SHARED_LIB_START
  11. .frame $sp, 32, $ra
  12. .set noreorder
  13. .cpload $t9
  14. /*
  15. Stack structure:
  16. sp+16 - gp
  17. sp+20 - sp
  18. sp+24 - ra
  19. */
  20. /* Save old sp, align the stack, set up the frame, save regs */
  21. move $t0, $sp
  22. li $t1, -8
  23. and $sp, $sp, $t1
  24. subu $sp, $sp, 32
  25. .cprestore 16
  26. sw $t0, 20($sp)
  27. sw $ra, 24($sp)
  28. /* Save initial stack pointer, return address */
  29. la $t0, __stkptr
  30. sw $sp, ($t0)
  31. /* Get environment from libc */
  32. la $t0, environ
  33. lw $t0, ($t0)
  34. bne $t0, $zero, GotEnv
  35. nop
  36. la $t0, EmptyEnv
  37. GotEnv:
  38. la $t1, operatingsystem_parameter_envp
  39. sw $t0, ($t1)
  40. /* Register exit handler */
  41. la $a0, FPC_LIB_EXIT
  42. jal atexit
  43. nop
  44. /* Call main, exit */
  45. jal PASCALMAIN
  46. nop
  47. /* restore registers, exit */
  48. lw $ra, 24($sp)
  49. jr $ra
  50. lw $sp, 20($sp)
  51. .end FPC_SHARED_LIB_START
  52. .size FPC_SHARED_LIB_START, .-FPC_SHARED_LIB_START
  53. /*************************/
  54. .global _haltproc
  55. _haltproc:
  56. .ent _haltproc
  57. .set noreorder
  58. .cpload $t9
  59. la $t9, exit
  60. jr $t9
  61. nop
  62. .end _haltproc
  63. .size _haltproc, .-_haltproc
  64. /*************************/
  65. .comm __stkptr,4
  66. .comm operatingsystem_parameter_envp,4
  67. operatingsystem_parameter_argc:
  68. .global operatingsystem_parameter_argc
  69. .long 1
  70. operatingsystem_parameter_argv:
  71. .global operatingsystem_parameter_argv
  72. .long EmptyCmdLine
  73. EmptyCmdLine:
  74. .long EmptyCmdStr
  75. EmptyCmdStr:
  76. .ascii "\0"
  77. EmptyEnv:
  78. .long 0
  79. .long 0
  80. .long 0
  81. /* --------------------------------------------------------- */
  82. .section .init_array, "aw"
  83. .long FPC_SHARED_LIB_START