How does the CPU distinguish CALL rel16
(E8 cw) and CALL rel32
(E8 cd)?
According to this site, mirroring the Intel architecture manuals, the opcodes for CALL rel16
and CALL rel32
are E8 cw
and E8 cd
, respectively.
This has made me wonder, how does the CPU distinguish these opcodes from each other, since E8 cw
might be a prefix of E8 cw
?
The prefix 66
is used to toggle between 16 and 32 bit operand size. So, in 16 bit operation modes, E8 cw
is CALL rel16
and 66 E8 cd
is CALL rel32
, while in 32 bit operation mode, E8 cd
is CALL rel32
and 66 E8 cw
is CALL rel16
.
In long mode (64 bit mode), CALL rel16
seems to be unavailable according to the Intel manuals. CALL rel32
works like in 32 bit mode but the rel32
immediate is sign extended to 64 bit and added to rip
instead of eip
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With