si_prc.pp 599 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {$SMARTLINK OFF}
  2. {$GOTO ON}
  3. unit si_prc;
  4. interface
  5. implementation
  6. procedure PascalMain; external name 'PASCALMAIN';
  7. var
  8. _bss_start: record end; external name '__bss_start__';
  9. _bss_end: record end; external name '__bss_end__';
  10. function _FPC_proc_start: longint; cdecl; public name '_start';
  11. label _loop, _exit;
  12. begin
  13. // fill the bss section with zeros
  14. asm
  15. la $t0, _bss_end
  16. la $t1, _bss_start
  17. sub $t0, $t0, $t1
  18. _loop:
  19. beq $t0, 0, _exit
  20. nop
  21. la $t1, _bss_start
  22. add $t1,$t1,$t0
  23. sw $0, 0($t1)
  24. addi $t0,$t0,-4
  25. j _loop
  26. nop
  27. _exit:
  28. end;
  29. PascalMain;
  30. end;
  31. begin
  32. end.