Browse Source

* made the i8086 internal assembler cpu instruction set checking follow the
asd_cpu directive (and thus, respect the {$asmcpu XXX} directive)

git-svn-id: trunk@33141 -

nickysn 9 years ago
parent
commit
c061a98e93
1 changed files with 43 additions and 40 deletions
  1. 43 40
      compiler/x86/aasmcpu.pas

+ 43 - 40
compiler/x86/aasmcpu.pas

@@ -1612,7 +1612,7 @@ implementation
         if (segprefix>=NR_ES) and (segprefix<=NR_GS) then
         if (segprefix>=NR_ES) and (segprefix<=NR_GS) then
          begin
          begin
 {$ifdef i8086}
 {$ifdef i8086}
-           if (current_settings.cputype<cpu_386) and
+           if (objdata.CPUType<>cpu_none) and (objdata.CPUType<cpu_386) and
               ((segprefix=NR_FS) or (segprefix=NR_GS)) then
               ((segprefix=NR_FS) or (segprefix=NR_GS)) then
              Message(asmw_e_instruction_not_supported_by_cpu);
              Message(asmw_e_instruction_not_supported_by_cpu);
 {$endif i8086}
 {$endif i8086}
@@ -2618,7 +2618,7 @@ implementation
            b66: Byte=$66;
            b66: Byte=$66;
          begin
          begin
 {$ifdef i8086}
 {$ifdef i8086}
-           if current_settings.cputype<cpu_386 then
+           if (objdata.CPUType<>cpu_none) and (objdata.CPUType<cpu_386) then
              Message(asmw_e_instruction_not_supported_by_cpu);
              Message(asmw_e_instruction_not_supported_by_cpu);
 {$endif i8086}
 {$endif i8086}
            objdata.writebytes(b66,1);
            objdata.writebytes(b66,1);
@@ -2629,7 +2629,7 @@ implementation
            b67: Byte=$67;
            b67: Byte=$67;
          begin
          begin
 {$ifdef i8086}
 {$ifdef i8086}
-           if current_settings.cputype<cpu_386 then
+           if (objdata.CPUType<>cpu_none) and (objdata.CPUType<cpu_386) then
              Message(asmw_e_instruction_not_supported_by_cpu);
              Message(asmw_e_instruction_not_supported_by_cpu);
 {$endif i8086}
 {$endif i8086}
            objdata.writebytes(b67,1);
            objdata.writebytes(b67,1);
@@ -2693,43 +2693,46 @@ implementation
         { check instruction's processor level }
         { check instruction's processor level }
         { todo: maybe adapt and enable this code for i386 and x86_64 as well }
         { todo: maybe adapt and enable this code for i386 and x86_64 as well }
 {$ifdef i8086}
 {$ifdef i8086}
-        case insentry^.flags and IF_PLEVEL of
-          IF_8086:
-            ;
-          IF_186:
-            if current_settings.cputype<cpu_186 then
-              Message(asmw_e_instruction_not_supported_by_cpu);
-          IF_286:
-            if current_settings.cputype<cpu_286 then
-              Message(asmw_e_instruction_not_supported_by_cpu);
-          IF_386:
-            if current_settings.cputype<cpu_386 then
-              Message(asmw_e_instruction_not_supported_by_cpu);
-          IF_486,
-          IF_PENT:
-            if current_settings.cputype<cpu_Pentium then
-              Message(asmw_e_instruction_not_supported_by_cpu);
-          IF_P6:
-            if current_settings.cputype<cpu_Pentium2 then
-              Message(asmw_e_instruction_not_supported_by_cpu);
-          IF_KATMAI:
-            if current_settings.cputype<cpu_Pentium3 then
-              Message(asmw_e_instruction_not_supported_by_cpu);
-          IF_WILLAMETTE,
-          IF_PRESCOTT:
-            if current_settings.cputype<cpu_Pentium4 then
-              Message(asmw_e_instruction_not_supported_by_cpu);
-          { the NEC V20/V30 extensions are incompatible with 386+, due to overlapping opcodes }
-          IF_NEC:
-            if current_settings.cputype>=cpu_386 then
-              Message(asmw_e_instruction_not_supported_by_cpu);
-          { todo: handle these properly }
-          IF_CYRIX,
-          IF_AMD,
-          IF_CENTAUR,
-          IF_SANDYBRIDGE:
-            ;
-        end;
+        if objdata.CPUType<>cpu_none then
+          begin
+            case insentry^.flags and IF_PLEVEL of
+              IF_8086:
+                ;
+              IF_186:
+                if objdata.CPUType<cpu_186 then
+                  Message(asmw_e_instruction_not_supported_by_cpu);
+              IF_286:
+                if objdata.CPUType<cpu_286 then
+                  Message(asmw_e_instruction_not_supported_by_cpu);
+              IF_386:
+                if objdata.CPUType<cpu_386 then
+                  Message(asmw_e_instruction_not_supported_by_cpu);
+              IF_486,
+              IF_PENT:
+                if objdata.CPUType<cpu_Pentium then
+                  Message(asmw_e_instruction_not_supported_by_cpu);
+              IF_P6:
+                if objdata.CPUType<cpu_Pentium2 then
+                  Message(asmw_e_instruction_not_supported_by_cpu);
+              IF_KATMAI:
+                if objdata.CPUType<cpu_Pentium3 then
+                  Message(asmw_e_instruction_not_supported_by_cpu);
+              IF_WILLAMETTE,
+              IF_PRESCOTT:
+                if objdata.CPUType<cpu_Pentium4 then
+                  Message(asmw_e_instruction_not_supported_by_cpu);
+              { the NEC V20/V30 extensions are incompatible with 386+, due to overlapping opcodes }
+              IF_NEC:
+                if objdata.CPUType>=cpu_386 then
+                  Message(asmw_e_instruction_not_supported_by_cpu);
+              { todo: handle these properly }
+              IF_CYRIX,
+              IF_AMD,
+              IF_CENTAUR,
+              IF_SANDYBRIDGE:
+                ;
+            end;
+          end;
 {$endif i8086}
 {$endif i8086}
 
 
         { load data to write }
         { load data to write }