dllprt0.as 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. /* Call main */
  41. jal FPC_LIB_MAIN_ANDROID
  42. nop
  43. /* Call library init */
  44. jal FPC_LIB_INIT_ANDROID
  45. nop
  46. /* restore registers, exit */
  47. lw $ra, 24($sp)
  48. jr $ra
  49. lw $sp, 20($sp)
  50. .end FPC_SHARED_LIB_START
  51. .size FPC_SHARED_LIB_START, .-FPC_SHARED_LIB_START
  52. /*************************/
  53. .global _haltproc
  54. _haltproc:
  55. .ent _haltproc
  56. .set noreorder
  57. .cpload $t9
  58. la $t9, exit
  59. jr $t9
  60. nop
  61. .end _haltproc
  62. .size _haltproc, .-_haltproc
  63. /*************************/
  64. .comm __stkptr,4
  65. .comm operatingsystem_parameter_envp,4
  66. operatingsystem_parameter_argc:
  67. .global operatingsystem_parameter_argc
  68. .long 1
  69. operatingsystem_parameter_argv:
  70. .global operatingsystem_parameter_argv
  71. .long EmptyCmdLine
  72. EmptyCmdLine:
  73. .long EmptyCmdStr
  74. EmptyCmdStr:
  75. .ascii "\0"
  76. EmptyEnv:
  77. .long 0
  78. .long 0
  79. .long 0
  80. /* --------------------------------------------------------- */
  81. .section .init_array, "aw"
  82. .long FPC_SHARED_LIB_START