prt0.as 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. Startup code for Android/MIPS
  3. by Vsevolod Alekseyev
  4. */
  5. .set at
  6. .section ".text"
  7. .align 4
  8. .global _fpc_start
  9. _fpc_start:
  10. .ent _fpc_start
  11. .set noreorder
  12. .cpload $t9
  13. /*Align the stack, save the old sp */
  14. move $t0, $sp
  15. li $t1, -8
  16. and $sp, $sp, $t1
  17. sw $t0, __stkptr
  18. /* Get argc/argv/envp from the stack; old sp is in t0 */
  19. lw $t1, ($t0)
  20. sw $t1, (operatingsystem_parameter_argc)
  21. addiu $t2, $t0, 4
  22. sw $t2, (operatingsystem_parameter_argv)
  23. addiu $t3, $t1, 1
  24. sll $t3, $t3, 2
  25. add $t2, $t2, $t3
  26. sw $t2, (operatingsystem_parameter_envp)
  27. la $t9, _start
  28. jr $t9
  29. nop
  30. .end _fpc_start
  31. /*************************/
  32. .global _haltproc
  33. _haltproc:
  34. .ent _haltproc
  35. .set noreorder
  36. .cpload $t9
  37. lw $a0, (operatingsystem_result)
  38. la $t9, exit
  39. jr $t9
  40. nop
  41. .end _haltproc
  42. .size _haltproc, .-_haltproc
  43. /*************************/
  44. .comm __stkptr,4
  45. .comm operatingsystem_parameter_envp,4
  46. .comm operatingsystem_parameter_argc,4
  47. .comm operatingsystem_parameter_argv,4