浏览代码

+ 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 -

nickysn 9 年之前
父节点
当前提交
a8ad82b99f
共有 3 个文件被更改,包括 14 次插入2 次删除
  1. 10 0
      compiler/fppu.pas
  2. 1 0
      compiler/ppu.pas
  3. 3 2
      compiler/utils/ppuutils/ppudump.pp

+ 10 - 0
compiler/fppu.pas

@@ -302,6 +302,14 @@ var
            Message(unit_u_ppu_invalid_memory_model,@queuecomment);
            Message(unit_u_ppu_invalid_memory_model,@queuecomment);
            exit;
            exit;
          end;
          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}
 {$endif i8086}
 {$ifdef cpufpemu}
 {$ifdef cpufpemu}
        { check if floating point emulation is on?
        { check if floating point emulation is on?
@@ -1293,6 +1301,8 @@ var
            flags:=flags or uf_i8086_huge_data;
            flags:=flags or uf_i8086_huge_data;
          if current_settings.x86memorymodel=mm_tiny then
          if current_settings.x86memorymodel=mm_tiny then
            flags:=flags or uf_i8086_cs_equals_ds;
            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}
 {$endif i8086}
 {$ifdef cpufpemu}
 {$ifdef cpufpemu}
          if (cs_fp_emulation in current_settings.moduleswitches) then
          if (cs_fp_emulation in current_settings.moduleswitches) then

+ 1 - 0
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_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_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_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
 type
   { bestreal is defined based on the target architecture }
   { bestreal is defined based on the target architecture }

+ 3 - 2
compiler/utils/ppuutils/ppudump.pp

@@ -537,7 +537,7 @@ type
     str  : string[30];
     str  : string[30];
   end;
   end;
 const
 const
-  flagopts=30;
+  flagopts=31;
   flagopt : array[1..flagopts] of tflagopt=(
   flagopt : array[1..flagopts] of tflagopt=(
     (mask: $1    ;str:'init'),
     (mask: $1    ;str:'init'),
     (mask: $2    ;str:'final'),
     (mask: $2    ;str:'final'),
@@ -570,7 +570,8 @@ const
     (mask: $8000000 ;str:'i8086_huge_data'),
     (mask: $8000000 ;str:'i8086_huge_data'),
     (mask: $10000000;str:'i8086_cs_equals_ds'),
     (mask: $10000000;str:'i8086_cs_equals_ds'),
     (mask: $20000000;str:'package_deny'),
     (mask: $20000000;str:'package_deny'),
-    (mask: $40000000;str:'package_weak')
+    (mask: $40000000;str:'package_weak'),
+    (mask: $80000000;str:'i8086_ss_equals_ds')
   );
   );
 var
 var
   i,ntflags : longint;
   i,ntflags : longint;