mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 05:49:23 +02:00
+ added checks for HeapOrg and HeapEnd to the i8086 compact and large memory
layout tests git-svn-id: trunk@28469 -
This commit is contained in:
parent
95bb0e0fd1
commit
d553e4572a
@ -25,6 +25,7 @@ program tmml;
|
|||||||
var
|
var
|
||||||
CS, DS, SS, HS: Word;
|
CS, DS, SS, HS: Word;
|
||||||
HeapP: Pointer;
|
HeapP: Pointer;
|
||||||
|
HeapOrgSeg, HeapOrgOfs, HeapEndSeg, HeapEndOfs: Word;
|
||||||
ErrorsFound: Boolean;
|
ErrorsFound: Boolean;
|
||||||
|
|
||||||
procedure Error(const S: string);
|
procedure Error(const S: string);
|
||||||
@ -48,10 +49,16 @@ begin
|
|||||||
DS := DSeg;
|
DS := DSeg;
|
||||||
SS := SSeg;
|
SS := SSeg;
|
||||||
HS := Seg(HeapP^);
|
HS := Seg(HeapP^);
|
||||||
|
HeapOrgSeg := Seg(HeapOrg^);
|
||||||
|
HeapOrgOfs := Ofs(HeapOrg^);
|
||||||
|
HeapEndSeg := Seg(HeapEnd^);
|
||||||
|
HeapEndOfs := Ofs(HeapEnd^);
|
||||||
Writeln('PrefixSeg=', PrefixSeg);
|
Writeln('PrefixSeg=', PrefixSeg);
|
||||||
Writeln('CS=', CS);
|
Writeln('CS=', CS);
|
||||||
Writeln('DS=', DS);
|
Writeln('DS=', DS);
|
||||||
Writeln('SS=', SS);
|
Writeln('SS=', SS);
|
||||||
|
Writeln('HeapOrg=', HeapOrgSeg, ':', HeapOrgOfs);
|
||||||
|
Writeln('HeapEnd=', HeapEndSeg, ':', HeapEndOfs);
|
||||||
Writeln('Heap Seg=', HS);
|
Writeln('Heap Seg=', HS);
|
||||||
if not (PrefixSeg < CS) then
|
if not (PrefixSeg < CS) then
|
||||||
Error('PrefixSeg >= CS');
|
Error('PrefixSeg >= CS');
|
||||||
@ -63,6 +70,14 @@ begin
|
|||||||
Error('DS >= SS');
|
Error('DS >= SS');
|
||||||
if not (SS < HS) then
|
if not (SS < HS) then
|
||||||
Error('SS >= HeapSeg');
|
Error('SS >= HeapSeg');
|
||||||
|
if HeapOrgOfs <> 0 then
|
||||||
|
Error('HeapOrg offset <> 0');
|
||||||
|
if HeapEndOfs <> 0 then
|
||||||
|
Error('HeapEnd offset <> 0');
|
||||||
|
if (HeapOrgSeg - SS) <> 1024 then
|
||||||
|
Error('HeapOrgSeg <> SS+1024 (16kb stack)');
|
||||||
|
if (PrefixSeg + MemW[PrefixSeg-1:3]) <> HeapEndSeg then
|
||||||
|
Error('HeapEnd segment <> end_of_current_program_MCB');
|
||||||
FreeMem(HeapP, 5);
|
FreeMem(HeapP, 5);
|
||||||
if ErrorsFound then
|
if ErrorsFound then
|
||||||
begin
|
begin
|
||||||
|
@ -21,6 +21,7 @@ program tmml;
|
|||||||
var
|
var
|
||||||
CS, DS, SS, HS: Word;
|
CS, DS, SS, HS: Word;
|
||||||
HeapP: Pointer;
|
HeapP: Pointer;
|
||||||
|
HeapOrgSeg, HeapOrgOfs, HeapEndSeg, HeapEndOfs: Word;
|
||||||
ErrorsFound: Boolean;
|
ErrorsFound: Boolean;
|
||||||
|
|
||||||
procedure Error(const S: string);
|
procedure Error(const S: string);
|
||||||
@ -44,10 +45,16 @@ begin
|
|||||||
DS := DSeg;
|
DS := DSeg;
|
||||||
SS := SSeg;
|
SS := SSeg;
|
||||||
HS := Seg(HeapP^);
|
HS := Seg(HeapP^);
|
||||||
|
HeapOrgSeg := Seg(HeapOrg^);
|
||||||
|
HeapOrgOfs := Ofs(HeapOrg^);
|
||||||
|
HeapEndSeg := Seg(HeapEnd^);
|
||||||
|
HeapEndOfs := Ofs(HeapEnd^);
|
||||||
Writeln('PrefixSeg=', PrefixSeg);
|
Writeln('PrefixSeg=', PrefixSeg);
|
||||||
Writeln('CS=', CS);
|
Writeln('CS=', CS);
|
||||||
Writeln('DS=', DS);
|
Writeln('DS=', DS);
|
||||||
Writeln('SS=', SS);
|
Writeln('SS=', SS);
|
||||||
|
Writeln('HeapOrg=', HeapOrgSeg, ':', HeapOrgOfs);
|
||||||
|
Writeln('HeapEnd=', HeapEndSeg, ':', HeapEndOfs);
|
||||||
Writeln('Heap Seg=', HS);
|
Writeln('Heap Seg=', HS);
|
||||||
if not (PrefixSeg < CS) then
|
if not (PrefixSeg < CS) then
|
||||||
Error('PrefixSeg >= CS');
|
Error('PrefixSeg >= CS');
|
||||||
@ -57,6 +64,14 @@ begin
|
|||||||
Error('DS >= SS');
|
Error('DS >= SS');
|
||||||
if not (SS < HS) then
|
if not (SS < HS) then
|
||||||
Error('SS >= HeapSeg');
|
Error('SS >= HeapSeg');
|
||||||
|
if HeapOrgOfs <> 0 then
|
||||||
|
Error('HeapOrg offset <> 0');
|
||||||
|
if HeapEndOfs <> 0 then
|
||||||
|
Error('HeapEnd offset <> 0');
|
||||||
|
if (HeapOrgSeg - SS) <> 1024 then
|
||||||
|
Error('HeapOrgSeg <> SS+1024 (16kb stack)');
|
||||||
|
if (PrefixSeg + MemW[PrefixSeg-1:3]) <> HeapEndSeg then
|
||||||
|
Error('HeapEnd segment <> end_of_current_program_MCB');
|
||||||
FreeMem(HeapP, 5);
|
FreeMem(HeapP, 5);
|
||||||
if ErrorsFound then
|
if ErrorsFound then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user