Fixed bug: some offsets were just plain wrong
authorceriel <none@none>
Fri, 19 Feb 1993 17:33:40 +0000 (17:33 +0000)
committerceriel <none@none>
Fri, 19 Feb 1993 17:33:40 +0000 (17:33 +0000)
mach/m68020/as/mach1.c
mach/m68020/as/mach4.c
mach/m68020/as/mach5.c

index 9d7148c..2899d02 100644 (file)
@@ -90,6 +90,9 @@ extern int dot_offset;
 #define        PUTW            0x40
 #define        PUTL            0x80
 
+extern int     curr_instr;
+extern int     curr_size;
+
 #ifndef extern
 extern short   eamode[];
 #else
index 9e7a598..38036e9 100644 (file)
@@ -14,6 +14,7 @@
 operation
        :               {       instrp = instr;
                                dot_offset = 0;
+                               curr_instr = curr_token;
                        }
                instruction
                        {       emit_instr();
@@ -131,7 +132,9 @@ instruction
                        {       movem(0, $2, $3);}
        |       MOVEM sizedef notimmreg ',' regs
                        {       movem(1, $2, $5);}
-       |       MOVESP sizedef ea_ea
+       |       MOVESP sizedef
+                       {       curr_size = $1; }
+               ea_ea
                        {       if ($1 == 0) {
                                        /* movep */
                                        movep($2);
@@ -372,8 +375,8 @@ reg :       DREG
                        {       $$ = $1 | 010;}
        ;
 sizedef        :       /* empty */
-                       {       $$ = SIZE_DEF;}
-       |       SIZE
+                       {       $$ = SIZE_DEF; curr_size = SIZE_DEF; }
+       |       SIZE    {       curr_size = $1; $$ = $1; }
        ;
 sizenon        :       /* empty */
                        {       $$ = SIZE_NON;}
index 687988a..d6d6d66 100644 (file)
@@ -628,8 +628,42 @@ ea7071(sz)
                return;
        }
        if ((bd_2.typ & ~S_DOT) == DOTTYP) {
-               if (small(fitw(bd_2.val-(DOTVAL+2)), 2)) {
-                       bd_2.val -= (DOTVAL+2);
+                       /* the "off" variable fixes the problem described above,
+                        * e.g., when references to program space are made by
+                        * instructions with more than one opcode word.
+                        */
+               int off = 2;
+
+               switch(curr_instr) {
+               case MOVEM:
+               case FMOVE:
+               case FMOVEM:
+               case FDYADIC:
+               case FMONADIC:
+               case FSINCOS:
+               case FSCC:
+               case FTST:
+               case DIVL:
+               case OP_RANGE:
+               case CALLM:
+               case CAS:
+               case CPSCC:
+               case CPTRAPCC:
+               case PFLUSH:
+               case PTEST:
+               case PMOVE:
+               case PLOAD:
+                       off = 4;
+                       break;
+               case MOVESP:
+                       if (curr_size != 0) off = 4;
+                       break;
+               case DIVMUL:
+                       if (curr_size != SIZE_W) off = 4;
+                       break;
+               }
+               if (small(fitw(bd_2.val-(DOTVAL+off)), 2)) {
+                       bd_2.val -= (DOTVAL+off);
                        mrg_2 = 072;
                }
        } else