Browse Source

+ PS1: initialize StackLength and StackBottom

Nikolay Nikolov 10 months ago
parent
commit
c24cae29d6
2 changed files with 6 additions and 1 deletions
  1. 1 1
      compiler/systems/i_ps1.pas
  2. 5 0
      rtl/ps1/system.pp

+ 1 - 1
compiler/systems/i_ps1.pas

@@ -35,7 +35,7 @@ unit i_ps1;
             system       : system_mipsel_ps1;
             name         : 'PlayStation 1 for MIPSEL';
             shortname    : 'ps1';
-            flags        : [tf_no_pic_supported, tf_smartlink_sections, tf_files_case_sensitive, tf_requires_proper_alignment];
+            flags        : [tf_no_pic_supported, tf_smartlink_sections, tf_files_case_sensitive, tf_requires_proper_alignment, tf_emit_stklen];
             cpu          : cpu_mipsel;
             unit_env     : '';
             extradefines : '';

+ 5 - 0
rtl/ps1/system.pp

@@ -43,6 +43,9 @@ var
 
 implementation
 
+var
+  StkLen: SizeUInt; external name '__stklen';
+
 procedure _InitHeap(p: pdword; l: dword); external name 'InitHeap2';
 procedure _free(p: pointer); external name 'free2';
 function _malloc(l: dword): pointer; external name 'malloc2';
@@ -110,6 +113,8 @@ end;
 
 
 begin
+  StackLength:=CheckInitialStkLen(stklen);
+  StackBottom:=Pointer(PtrUInt($80200000)-PtrUInt(StackLength));
   InOutRes:= 0;
   _InitHeap(pdword($800F8000), $00100000);
 end.