Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report : Issue with 16-bit call instruction. #5

Closed
mylifeisabug opened this issue Feb 26, 2018 · 1 comment
Closed

Bug report : Issue with 16-bit call instruction. #5

mylifeisabug opened this issue Feb 26, 2018 · 1 comment
Labels

Comments

@mylifeisabug
Copy link

mylifeisabug commented Feb 26, 2018

I raised this bug over on the CyberChef issues page, and the devs over there pointed me here.

Basically, in 16-bit code, an intra-segment direct CALL (opcode starting with 0xE8) should only be three bytes long and take a single 16-bit displacement like so: 0xE8, disp-low, disp-high

But, the two bytes following the CALL are also grouped in with the opcode, which would be correct only in 32-bit code.

Here's a disassembly of a raw hex file containing the bytes E8 00 00 90 90 using ndisasm.exe with the CPU Mode set to 16-bit:

call16

And here's a disassembly of the same file with the CPU mode set to 32-bit:

call32

Neither of these are output by your x86 disassembler, in this case it outputs CALL 0005 and no NOP instructions which isn't correct. This form of CALL shouldn't be five bytes long in 16-bit code, it should be three bytes long instead.

@Recoskie Recoskie added the bug label Mar 19, 2018
Recoskie added a commit that referenced this issue Mar 19, 2018
@Recoskie
Copy link
Owner

Thanks for noticing the Call instruction 0xE8, and Jump instruction 0xE9 did not adjust displacement size to the set bit mode. The two instructions had been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants