mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 07:39:25 +02:00
* added hack to support stack exceeding 32kb in size in the i8086 far data
memory models git-svn-id: trunk@27827 -
This commit is contained in:
parent
2c6d3f1428
commit
47a7a9835a
@ -38,18 +38,35 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
globals,cpuinfo,
|
||||
sysutils,cutils,
|
||||
globtype,globals,cpuinfo,
|
||||
aasmbase,aasmdata,aasmtai;
|
||||
|
||||
|
||||
class procedure ti8086nodeutils.InsertMemorySizes;
|
||||
var
|
||||
stacksizeleft,stackblock: LongInt;
|
||||
i: Integer;
|
||||
begin
|
||||
inherited;
|
||||
if current_settings.x86memorymodel in x86_far_data_models then
|
||||
begin
|
||||
maybe_new_object_file(current_asmdata.asmlists[al_globals]);
|
||||
new_section(current_asmdata.asmlists[al_globals],sec_stack,'__stack', 16);
|
||||
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___stack', stacksize));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_symbol.Createname_global('___stack', AT_DATA, stacksize));
|
||||
{ HACK: since tai_datablock's size parameter is aint, which cannot be
|
||||
larger than 32767 on i8086, but we'd like to support stack size of
|
||||
up to 64kb, we may need to use several tai_datablocks to reserve
|
||||
the stack segment }
|
||||
i:=0;
|
||||
stacksizeleft:=stacksize;
|
||||
while stacksizeleft>0 do
|
||||
begin
|
||||
stackblock:=min(stacksizeleft,high(aint));
|
||||
current_asmdata.asmlists[al_globals].concat(tai_datablock.Create('___stackblock'+IntToStr(i),stackblock));
|
||||
dec(stacksizeleft,stackblock);
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user