From dfc4956d59c695eec5798f295a13c89f63cd3689 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 19 Feb 1993 17:33:40 +0000 Subject: [PATCH] Fixed bug: some offsets were just plain wrong --- mach/m68020/as/mach1.c | 3 +++ mach/m68020/as/mach4.c | 9 ++++++--- mach/m68020/as/mach5.c | 38 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/mach/m68020/as/mach1.c b/mach/m68020/as/mach1.c index 9d7148cb7..2899d02e5 100644 --- a/mach/m68020/as/mach1.c +++ b/mach/m68020/as/mach1.c @@ -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 diff --git a/mach/m68020/as/mach4.c b/mach/m68020/as/mach4.c index 9e7a59881..38036e9c9 100644 --- a/mach/m68020/as/mach4.c +++ b/mach/m68020/as/mach4.c @@ -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;} diff --git a/mach/m68020/as/mach5.c b/mach/m68020/as/mach5.c index 687988a8c..d6d6d665b 100644 --- a/mach/m68020/as/mach5.c +++ b/mach/m68020/as/mach5.c @@ -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