Absolute effective addresses are decoded by DecodeBInstruction().
Because they are encoded as normal disp24 value.
To form the EA:
The lower 20bits are shifted by one, and the upper 4bits by 1 (jumps) or 7 (calls).
The ISA sign extends disponents values of 8, 15 and 24 bits.
For address disponents it also shifts the results by 1 for alignment.
The ISA has two writing styles for this though:
sign_ext(dispXX 2) and sign_ext(dispXX) 2.
Assuming that sign_ext() always works on the MSB of the value
they are eqivalent. Because:
sign_ext(disp8 2) = sign_ext(disp8 2 = disp9) = sign_ext(disp9) = sign_ext(disp8) * 2.
This let to confusion before and for the sign_ext(dispXX * 2) case,
and the wrong bit was checked for sign extension (e.g bit 8 for an effective disp9 value).
Your checklist for this pull request
Detailed description
Fixes two issues with address calculation:
Fix absolute address calculations.
Absolute effective addresses are decoded by DecodeBInstruction(). Because they are encoded as normal disp24 value. To form the EA: The lower 20bits are shifted by one, and the upper 4bits by 1 (jumps) or 7 (calls).
Fix PC relative disponents.
The ISA sign extends disponents values of 8, 15 and 24 bits. For address disponents it also shifts the results by 1 for alignment.
The ISA has two writing styles for this though: sign_ext(dispXX 2) and sign_ext(dispXX) 2.
Assuming that sign_ext() always works on the MSB of the value they are eqivalent. Because: sign_ext(disp8 2) = sign_ext(disp8 2 = disp9) = sign_ext(disp9) = sign_ext(disp8) * 2.
This let to confusion before and for the sign_ext(dispXX * 2) case, and the wrong bit was checked for sign extension (e.g bit 8 for an effective disp9 value).
Test plan
Not yet added.
Closing issues
...