diff options
author | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-04-15 00:12:40 +0000 |
---|---|---|
committer | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-04-15 00:12:40 +0000 |
commit | 67227f724de3e59bfed5917bdf6dd77d8692b53a (patch) | |
tree | b2001a22e252d65cb359799d03443dbcb94156a6 /compiler/x86 | |
parent | 0f375bc4cf38d938fae5846c799e6368ebc63b51 (diff) | |
download | fpc-67227f724de3e59bfed5917bdf6dd77d8692b53a.tar.gz |
+ support far calls and jumps in the internal asm writer
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@30601 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/x86')
-rw-r--r-- | compiler/x86/aasmcpu.pas | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/compiler/x86/aasmcpu.pas b/compiler/x86/aasmcpu.pas index c01a06f14c..dc699a6b57 100644 --- a/compiler/x86/aasmcpu.pas +++ b/compiler/x86/aasmcpu.pas @@ -1242,7 +1242,10 @@ implementation end else {$ifdef i8086} - ot:=OT_IMM16 or OT_NEAR; + if opsize=S_FAR then + ot:=OT_IMM16 or OT_FAR + else + ot:=OT_IMM16 or OT_NEAR; {$else i8086} ot:=OT_IMM32 or OT_NEAR; {$endif i8086} @@ -1359,6 +1362,9 @@ implementation if ((insot and OT_SIZE_MASK)<>0) and ((insot and currot and OT_SIZE_MASK)<>(currot and OT_SIZE_MASK)) then exit; + { "far" matches only with "far" } + if (insot and OT_FAR)<>(currot and OT_FAR) then + exit; end; { Check operand sizes } @@ -1417,6 +1423,8 @@ implementation ((currot and OT_IMMEDIATE)=0) and (((insot and OT_SIZE_MASK) or siz[i])<(currot and OT_SIZE_MASK)) then exit; + if (insot and OT_FAR)<>(currot and OT_FAR) then + exit; end; end; @@ -2249,10 +2257,14 @@ implementation inc(len,2); &34,&35,&36: begin +{$ifdef i8086} + inc(len,2); +{$else i8086} if opsize=S_Q then inc(len,8) else inc(len,4); +{$endif i8086} end; &44,&45,&46: inc(len,sizeof(pint)); @@ -2881,6 +2893,12 @@ implementation on address size, *not* operand size. Works by coincidence only. } begin getvalsym(c-&34); +{$ifdef i8086} + if assigned(currsym) then + objdata_writereloc(currval,2,currsym,currabsreloc) + else + objdata.writebytes(currval,2); +{$else i8086} if opsize=S_Q then begin if assigned(currsym) then @@ -2895,6 +2913,7 @@ implementation else objdata.writebytes(currval,4); end +{$endif i8086} end; &40,&41,&42 : // 040..042 begin @@ -3122,7 +3141,17 @@ implementation else Internalerror(2014032008); end; &370..&372: ; // VEX flags =>> nothing todo - &37, + &37: + begin +{$ifdef i8086} + if assigned(currsym) then + objdata_writereloc(0,2,currsym,RELOC_SEG) + else + InternalError(2015041503); +{$else i8086} + InternalError(777006); +{$endif i8086} + end; &60,&61,&62 : begin InternalError(777006); |