Przeglądaj źródła

* i8086 small and tiny memory model ppus made incompatible. Rationale:
o the maintenance effort will be less - previously we had to test 4
combinations:
tiny program with tiny rtl
tiny program with small rtl
small program with tiny rtl
small program with small rtl
I only tested both tiny and small programs with the small rtl, so I missed
a bug, which caused small programs built with the tiny rtl to always give
a "Nil pointer assignment" error. Now we only need to test two cases:
tiny program with tiny rtl
small program with small rtl
o I'm planning a bug fix for interrupt procedures in the tiny model, which
will make their prolog differ between small and tiny. Currently, they're
not used in the rtl, but that may change. And even if it doesn't,
interrupt procedures may also be used by user units.

git-svn-id: trunk@27516 -

nickysn 11 lat temu
rodzic
commit
e21783a281
3 zmienionych plików z 14 dodań i 2 usunięć
  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

@@ -256,6 +256,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.flags and uf_i8086_cs_equals_ds)<>0) xor
+            (current_settings.x86memorymodel=mm_tiny) 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?
@@ -1095,6 +1103,8 @@ var
            flags:=flags or uf_i8086_far_data;
            flags:=flags or uf_i8086_far_data;
          if current_settings.x86memorymodel=mm_huge then
          if current_settings.x86memorymodel=mm_huge then
            flags:=flags or uf_i8086_huge_data;
            flags:=flags or uf_i8086_huge_data;
+         if current_settings.x86memorymodel=mm_tiny then
+           flags:=flags or uf_i8086_cs_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

@@ -165,6 +165,7 @@ const
   uf_i8086_far_code     = $2000000; { this unit uses an i8086 memory model with far code (i.e. medium, large or huge) }
   uf_i8086_far_code     = $2000000; { this unit uses an i8086 memory model with far code (i.e. medium, large or huge) }
   uf_i8086_far_data     = $4000000; { this unit uses an i8086 memory model with far data (i.e. compact or large) }
   uf_i8086_far_data     = $4000000; { this unit uses an i8086 memory model with far data (i.e. compact or large) }
   uf_i8086_huge_data    = $8000000; { this unit uses an i8086 memory model with huge data (i.e. huge) }
   uf_i8086_huge_data    = $8000000; { this unit uses an i8086 memory model with huge data (i.e. huge) }
+  uf_i8086_cs_equals_ds = $10000000; { this unit uses an i8086 memory model with CS=DS (i.e. tiny) }
 
 
 {$ifdef generic_cpu}
 {$ifdef generic_cpu}
 { We need to use the correct size of aint and pint for
 { We need to use the correct size of aint and pint for

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

@@ -475,7 +475,7 @@ type
     str  : string[30];
     str  : string[30];
   end;
   end;
 const
 const
-  flagopts=27;
+  flagopts=28;
   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'),
@@ -505,7 +505,8 @@ const
     (mask: $1000000 ;str:'has_resstrinits'),
     (mask: $1000000 ;str:'has_resstrinits'),
     (mask: $2000000 ;str:'i8086_far_code'),
     (mask: $2000000 ;str:'i8086_far_code'),
     (mask: $4000000 ;str:'i8086_far_data'),
     (mask: $4000000 ;str:'i8086_far_data'),
-    (mask: $8000000 ;str:'i8086_huge_data')
+    (mask: $8000000 ;str:'i8086_huge_data'),
+    (mask: $10000000;str:'i8086_cs_equals_ds')
   );
   );
 var
 var
   i,ntflags : longint;
   i,ntflags : longint;