si_prc.inc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2019 by Jeppe Johansen.
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. {******************************************************************************
  11. Process start/halt
  12. ******************************************************************************}
  13. var
  14. dlexitproc : pointer;
  15. var
  16. BSS_START: record end; external name '__bss_start';
  17. STACK_PTR: record end; external name '__stkptr';
  18. procedure _FPC_xtensa_enter(sp: pptruint);
  19. var
  20. argc: ptruint;
  21. begin
  22. argc:=sp[0];
  23. initialstkptr:=sp;
  24. operatingsystem_parameter_argc:=argc;
  25. operatingsystem_parameter_argv:=@sp[1];
  26. operatingsystem_parameter_envp:=@sp[argc+2];
  27. PascalMain;
  28. end;
  29. procedure _FPC_proc_start; assembler; public name '_start';
  30. asm
  31. { outermost stack frame }
  32. movi a0,0
  33. { pass stack pointer }
  34. mov a6,a1
  35. call4 _FPC_xtensa_enter
  36. end;
  37. procedure _FPC_dynamic_proc_start; assembler; public name '_dynamic_start';
  38. asm
  39. ill
  40. end;
  41. procedure _FPC_xtensa_exit(e:longint); assembler;
  42. asm
  43. .L1:
  44. mov a6,a3
  45. movi a2,119
  46. syscall
  47. j .L1
  48. end;
  49. procedure _FPC_proc_haltproc(e:longint); cdecl; public name '_haltproc';
  50. begin
  51. if assigned(dlexitproc) then
  52. TProcedure(dlexitproc);
  53. _FPC_xtensa_exit(e);
  54. end;