Ver código fonte

* allow setting the stack size from FPC

git-svn-id: branches/z80@45104 -
nickysn 5 anos atrás
pai
commit
78c40a6d70
2 arquivos alterados com 16 adições e 6 exclusões
  1. 12 0
      compiler/ngenutil.pas
  2. 4 6
      rtl/zxspectrum/prt0.asm

+ 12 - 0
compiler/ngenutil.pas

@@ -1516,6 +1516,18 @@ implementation
           );
           tcb.free;
         end;
+
+      { allocate the stack on the ZX Spectrum system }
+      if target_info.system in [system_z80_zxspectrum] then
+        begin
+          { tai_datablock cannot yet be handled via the high level typed const
+            builder, because it implies the generation of a symbol, while this
+            is separate in the builder }
+          maybe_new_object_file(current_asmdata.asmlists[al_globals]);
+          new_section(current_asmdata.asmlists[al_globals],sec_stack,'__fpc_stackarea_start',current_settings.alignment.varalignmax);
+          current_asmdata.asmlists[al_globals].concat(tai_datablock.Create_global('__fpc_stackarea_start',stacksize-1,carraydef.getreusable(u8inttype,stacksize-1),AT_DATA));
+          current_asmdata.asmlists[al_globals].concat(tai_datablock.Create_global('__fpc_stackarea_end',1,carraydef.getreusable(u8inttype,1),AT_DATA));
+        end;
 {$IFDEF POWERPC}
       { AmigaOS4 "stack cookie" support }
       if ( target_info.system = system_powerpc_amiga ) then

+ 4 - 6
rtl/zxspectrum/prt0.asm

@@ -1,12 +1,10 @@
                         .area _CODE
                         .globl PASCALMAIN
                         .globl FPC_SAVE_IY
+                        .globl __fpc_stackarea_start
+                        .globl __fpc_stackarea_end
+
 start::
-                        ld sp, #stack_area_end
+                        ld sp, #__fpc_stackarea_end
                         ld (FPC_SAVE_IY), iy
                         jp PASCALMAIN
-
-                        .area _DATA
-stack_area_start:       ;.rs 1022
-                        .rs 254
-stack_area_end:         .rs 2