Browse Source

human68k: setup the stack, then use setblock to limit the memory usage to the amount we're really using. this frees up RAM, and allows the heap allocator to work.

Karoly Balogh 1 year ago
parent
commit
d009941744
1 changed files with 6 additions and 0 deletions
  1. 6 0
      rtl/human68k/si_prc.pp

+ 6 - 0
rtl/human68k/si_prc.pp

@@ -35,6 +35,8 @@ procedure PascalStart(const startparams: Ph68kdos_startup); noreturn; forward;
 { this function must be the first in this unit which contains code }
 procedure _FPC_proc_start; assembler; nostackframe; noreturn; public name '_start';
 asm
+  move.l  a1,sp
+  add.l   stklen,sp
   movem.l a0-a5,-(sp)
   move.l sp,a0
   jbsr PascalStart
@@ -49,6 +51,10 @@ begin
       { clear BSS }
       bss_start:=pbyte(pdword(@mcb[$30])^);
       fillchar(bss_start^,bss_end-bss_start,0);
+
+      h68k_psp:=pointer(@mcb[$10]);
+      h68kdos_setblock(h68k_psp,bss_end-pointer(h68k_psp)+stklen);
+      stacktop:=bss_end+stklen;
     end;
 
   h68k_startup:=startparams^;