CALL
CALL
Usage: CALL dest Modifies flags: None
Pushes Instruction Pointer onto stack and loads Instruction Pointer with the address of proc-name.
Code continues with execution at EIP upon RET.
Call Subroutine
CALL imm ; E8 rw/rd [8086]
CALL imm:imm16 ; o16 9A iw iw [8086]
CALL imm:imm32 ; o32 9A id iw [386]
CALL FAR mem16 ; o16 FF /3 [8086]
CALL FAR mem32 ; o32 FF /3 [386]
CALL r/m16 ; o16 FF /2 [8086]
CALL r/m32 ; o32 FF /2 [386]
CALL calls a subroutine, by means of pushing the current instruction pointer (IP) and optionally CS as well on the stack, and then jumping to a given address.
CS is pushed as well as IP if and only if the call is a far call, i.e. a destination segment address is specified in the instruction. The forms involving two colon-separated arguments are far calls; so are the CALL FAR mem forms.
The immediate call takes one of two forms (call imm16/imm32, determined by the current segment size limit. For 16-bit operands, you would use CALL 0x1234, and for 32-bit operands you would use CALL 0x12345678. The value passed as an operand is a relative offset.
You can choose between the two immediate call forms (CALL imm:imm) by the use of the WORD and DWORD keywords:
CALL WORD 0x1234:0x5678) or CALL DWORD 0x1234:0x56789abc.
The CALL FAR mem forms execute a far call by loading the destination address out of memory. The address loaded consists of 16 or 32 bits of offset (depending on the operand size), and 16 bits of segment. The operand size may be overridden using:
CALL WORD FAR mem or CALL DWORD FAR mem.
The CALL r/m forms execute a call (within the same segment), loading the destination address out of memory or out of a register. The keyword NEAR may be specified, for clarity, in these forms, but is not necessary. Again, operand size can be overridden using CALL WORD mem or CALL DWORD mem.
Example: (RosAsm)
main:
If B$WriteCheckerWanted = &TRUE
cmp eax 32 | je L1> ; If eax = 32 then goto L1
cmp eax CR | je L1> ; If eax = CR then goto L1
cmp eax ',' | je L1> ; If eax = ',' then goto L1
cmp eax 8 | je L1> ; If eax = 8 then goto L1
cmp eax Tab | jne L0> ; If eax !=Tab then goto L0
L1: call Label
....
....
ret
- ۰۱/۰۳/۲۳