mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 03:19:27 +02:00
* let the compiler generate the stack segment in i8086 near data memory models
as well. Even though, in these models, the stack is dynamically allocated (because it goes on top of the heap, but the heap is variable size), there are still benefits: 1) the program will run on a larger stack during initialization, before the actual stack (and heap) are ready 2) in cases, when the system is extremely low on memory, DOS will reject to load the program if there's not enough memory for the stack the program requires. This way the startup code can be further simplified by omitting the 'not enough memory' check in the future (when we add the minimum heap size to the executable reserved space as well). git-svn-id: trunk@27903 -
This commit is contained in:
parent
81c7b22199
commit
73d7f2aa18
@ -47,8 +47,7 @@ implementation
|
||||
class procedure ti8086nodeutils.InsertMemorySizes;
|
||||
begin
|
||||
inherited;
|
||||
if current_settings.x86memorymodel in x86_far_data_models then
|
||||
InsertStackSegment;
|
||||
InsertStackSegment;
|
||||
end;
|
||||
|
||||
|
||||
@ -73,6 +72,7 @@ implementation
|
||||
dec(stacksizeleft,stackblock);
|
||||
inc(i);
|
||||
end;
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___stacktop',AT_DATA,0));
|
||||
end;
|
||||
|
||||
|
||||
|
@ -1226,16 +1226,13 @@ interface
|
||||
AsmWriteLn('SECTION .fpc');
|
||||
{ WLINK requires class=bss in order to leave the BSS section out of the executable }
|
||||
AsmWriteLn('SECTION .bss class=bss');
|
||||
if current_settings.x86memorymodel in x86_far_data_models then
|
||||
if current_settings.x86memorymodel<>mm_tiny then
|
||||
AsmWriteLn('SECTION stack stack class=stack align=16');
|
||||
{ group these sections in the same segment }
|
||||
if current_settings.x86memorymodel=mm_tiny then
|
||||
AsmWriteLn('GROUP dgroup text rodata data fpc bss')
|
||||
else
|
||||
if current_settings.x86memorymodel in x86_far_data_models then
|
||||
AsmWriteLn('GROUP dgroup rodata data fpc bss stack')
|
||||
else
|
||||
AsmWriteLn('GROUP dgroup rodata data fpc bss');
|
||||
AsmWriteLn('GROUP dgroup rodata data fpc bss stack');
|
||||
if paratargetdbg in [dbg_dwarf2,dbg_dwarf3,dbg_dwarf4] then
|
||||
begin
|
||||
AsmWriteLn('SECTION .debug_frame use32 class=DWARF');
|
||||
|
@ -56,6 +56,9 @@
|
||||
%ifdef __FAR_DATA__
|
||||
extern ___stack
|
||||
%endif
|
||||
%ifdef __NEAR_DATA__
|
||||
extern ___stacktop
|
||||
%endif
|
||||
|
||||
extern __SaveInt00
|
||||
|
||||
@ -72,7 +75,7 @@
|
||||
%ifdef __NEAR_DATA__
|
||||
; init the stack
|
||||
mov ss, bx
|
||||
mov sp, stacktop
|
||||
mov sp, ___stacktop wrt dgroup
|
||||
%endif
|
||||
%endif
|
||||
|
||||
@ -475,8 +478,6 @@ __nullarea:
|
||||
|
||||
%ifdef __NEAR_DATA__
|
||||
segment stack stack class=stack
|
||||
resb 256
|
||||
stacktop:
|
||||
%else
|
||||
segment data
|
||||
; add reference to the beginning of stack, so the object module,
|
||||
|
Loading…
Reference in New Issue
Block a user