Browse Source

* add .byte 066h to force correct pushw %es
* handle push es as a pushl %es

pierre 25 years ago
parent
commit
495fd674a7
3 changed files with 46 additions and 6 deletions
  1. 15 1
      compiler/ag386int.pas
  2. 16 2
      compiler/ag386nsm.pas
  3. 15 3
      compiler/ra386.pas

+ 15 - 1
compiler/ag386int.pas

@@ -488,6 +488,16 @@ unit ag386int;
                        suffix:='';
                        prefix:= '';
                        s:='';
+                      { We need to explicitely set
+                        word prefix to get selectors
+                        to be pushed in 2 bytes  PM }
+                      if (paicpu(hp)^.opsize=S_W) and
+                         ((paicpu(hp)^.opcode=A_PUSH) or
+                          (paicpu(hp)^.opcode=A_POP)) and
+                          (paicpu(hp)^.oper[0].typ=top_reg) and
+                          ((paicpu(hp)^.oper[0].reg>=firstsreg) and
+                           (paicpu(hp)^.oper[0].reg<=lastsreg)) then
+                        AsmWriteln(#9#9'DB'#9'066h');
                      { added prefix instructions, must be on same line as opcode }
                        if (paicpu(hp)^.ops = 0) and
                           ((paicpu(hp)^.opcode = A_REP) or
@@ -633,7 +643,11 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.60  2000-04-06 07:05:57  pierre
+  Revision 1.61  2000-05-09 21:44:27  pierre
+    * add .byte 066h to force correct pushw %es
+    * handle push es as a pushl %es
+
+  Revision 1.60  2000/04/06 07:05:57  pierre
    * handle offsetfixup
 
   Revision 1.59  2000/02/09 13:22:43  peter

+ 16 - 2
compiler/ag386nsm.pas

@@ -639,7 +639,17 @@ unit ag386nsm;
                    s:=#9+getopstr_jmp(paicpu(hp)^.oper[0],paicpu(hp)^.opcode)
                   else
                    begin
-                     for i:=0to paicpu(hp)^.ops-1 do
+                      { We need to explicitely set
+                        word prefix to get selectors
+                        to be pushed in 2 bytes  PM }
+                      if (paicpu(hp)^.opsize=S_W) and
+                         ((paicpu(hp)^.opcode=A_PUSH) or
+                          (paicpu(hp)^.opcode=A_POP)) and
+                          (paicpu(hp)^.oper[0].typ=top_reg) and
+                          ((paicpu(hp)^.oper[0].reg>=firstsreg) and
+                           (paicpu(hp)^.oper[0].reg<=lastsreg)) then
+                        AsmWriteln(#9#9'DB'#9'066h');
+                     for i:=0 to paicpu(hp)^.ops-1 do
                       begin
                         if i=0 then
                          sep:=#9
@@ -754,7 +764,11 @@ unit ag386nsm;
 end.
 {
   $Log$
-  Revision 1.57  2000-04-06 07:09:15  pierre
+  Revision 1.58  2000-05-09 21:44:27  pierre
+    * add .byte 066h to force correct pushw %es
+    * handle push es as a pushl %es
+
+  Revision 1.57  2000/04/06 07:09:15  pierre
     * handle offset fixup
     + add source lines
     * no NEAR for opcodes that only support short jumps

+ 15 - 3
compiler/ra386.pas

@@ -226,7 +226,15 @@ begin
   case ops of
     0 : ;
     1 :
-      opsize:=operands[1]^.size;
+      { "push es" must be stored as a long PM }
+      if ((opcode=A_PUSH) or
+          (opcode=A_POP)) and
+         (operands[1]^.opr.typ=OPR_REGISTER) and
+         ((operands[1]^.opr.reg>=firstsreg) and
+          (operands[1]^.opr.reg<=lastsreg)) then
+        opsize:=S_L
+      else
+        opsize:=operands[1]^.size;
     2 :
       begin
         case opcode of
@@ -267,7 +275,7 @@ begin
   { Check only the most common opcodes here, the others are done in
     the assembler pass }
   case opcode of
-    A_PUSH,A_DEC,A_INC,A_NOT,A_NEG,
+    A_PUSH,A_POP,A_DEC,A_INC,A_NOT,A_NEG,
     A_CMP,A_MOV,
     A_ADD,A_SUB,A_ADC,A_SBB,
     A_AND,A_OR,A_TEST,A_XOR: ;
@@ -365,7 +373,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.14  2000-04-14 12:26:33  pierre
+  Revision 1.15  2000-05-09 21:44:28  pierre
+    * add .byte 066h to force correct pushw %es
+    * handle push es as a pushl %es
+
+  Revision 1.14  2000/04/14 12:26:33  pierre
    avoid to reset operand size of opsize is S_NO
 
   Revision 1.13  2000/04/04 13:48:44  pierre