How does the CPU distinguish between "CALL rel16" (E8 cw) and "CALL rel32" (E8 cd)?

How does a CPU distinguish between CALL rel16 (E8 cw) and CALL rel32 (E8 cd)?

According to this site , mirroring Intel architecture guides, the operation codes for CALL rel16 and CALL rel32 are E8 cw and E8 cd respectively.

This made me wonder how the CPU distinguishes these opcodes from each other, since E8 cw may be the prefix E8 cw ?

+8
assembly x86 isa
source share
1 answer

The prefix 66 used to switch between the size of operands ranging in size from 16 to 32 bits. Thus, in 16-bit operating modes, E8 cw is CALL rel16 , and 66 E8 cd is CALL rel32 , and in 32-bit E8 cd is CALL rel32 and 66 E8 cw is CALL rel16 .

In long mode (64-bit mode), CALL rel16 seems unavailable according to Intel guidelines. CALL rel32 works like in 32-bit mode, but rel32 immediate is a character expanded to 64 bits and added to rip instead of eip .

+11
source share

All Articles