From a8ad82b99f94fdc1a6b1a81e9ce93fd61e60b738 Mon Sep 17 00:00:00 2001 From: nickysn Date: Sat, 16 Jul 2016 11:16:25 +0000 Subject: [PATCH] + added new unit flag uf_i8086_ss_equals_ds, which indicates memory models with SS=DS. This is currently redundant (whether SS=DS can be derived by the other i8086 memory model unit flags), but in the future will allow adding extra memory models, where the SS=DS assumption differs from the current ones. git-svn-id: trunk@34139 - --- compiler/fppu.pas | 10 ++++++++++ compiler/ppu.pas | 1 + compiler/utils/ppuutils/ppudump.pp | 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/compiler/fppu.pas b/compiler/fppu.pas index b8066c289d..c9505d9f49 100644 --- a/compiler/fppu.pas +++ b/compiler/fppu.pas @@ -302,6 +302,14 @@ var Message(unit_u_ppu_invalid_memory_model,@queuecomment); exit; end; + if ((ppufile.header.common.flags and uf_i8086_ss_equals_ds)<>0) xor + (current_settings.x86memorymodel in [mm_tiny,mm_small,mm_medium]) then + begin + ppufile.free; + ppufile:=nil; + Message(unit_u_ppu_invalid_memory_model,@queuecomment); + exit; + end; {$endif i8086} {$ifdef cpufpemu} { check if floating point emulation is on? @@ -1293,6 +1301,8 @@ var flags:=flags or uf_i8086_huge_data; if current_settings.x86memorymodel=mm_tiny then flags:=flags or uf_i8086_cs_equals_ds; + if current_settings.x86memorymodel in [mm_tiny,mm_small,mm_medium] then + flags:=flags or uf_i8086_ss_equals_ds; {$endif i8086} {$ifdef cpufpemu} if (cs_fp_emulation in current_settings.moduleswitches) then diff --git a/compiler/ppu.pas b/compiler/ppu.pas index 57cb300bb9..ee1cd25338 100644 --- a/compiler/ppu.pas +++ b/compiler/ppu.pas @@ -78,6 +78,7 @@ const uf_i8086_cs_equals_ds = $10000000; { this unit uses an i8086 memory model with CS=DS (i.e. tiny) } uf_package_deny = $20000000; { this unit must not be part of a package } uf_package_weak = $40000000; { this unit may be completely contained in a package } + uf_i8086_ss_equals_ds = $80000000; { this unit uses an i8086 memory model with SS=DS (i.e. tiny, small or medium) } type { bestreal is defined based on the target architecture } diff --git a/compiler/utils/ppuutils/ppudump.pp b/compiler/utils/ppuutils/ppudump.pp index aebc04d4e3..f235d39bdf 100644 --- a/compiler/utils/ppuutils/ppudump.pp +++ b/compiler/utils/ppuutils/ppudump.pp @@ -537,7 +537,7 @@ type str : string[30]; end; const - flagopts=30; + flagopts=31; flagopt : array[1..flagopts] of tflagopt=( (mask: $1 ;str:'init'), (mask: $2 ;str:'final'), @@ -570,7 +570,8 @@ const (mask: $8000000 ;str:'i8086_huge_data'), (mask: $10000000;str:'i8086_cs_equals_ds'), (mask: $20000000;str:'package_deny'), - (mask: $40000000;str:'package_weak') + (mask: $40000000;str:'package_weak'), + (mask: $80000000;str:'i8086_ss_equals_ds') ); var i,ntflags : longint;