Code: Select all
call EAX; push and jump to address in EAX
Code: Select all
call [EAX+0xf0]; push and jump to address that EAX and displacement point to.
Code: Select all
call EAX; push and jump to address in EAX
Code: Select all
call [EAX+0xf0]; push and jump to address that EAX and displacement point to.
Code: Select all
CALL thing
Code: Select all
MOV EAX, thing
CALL EAX
Code: Select all
org 0
bits 32
Start:
mov eax, SomeTable
call dword [eax+8] ; call "SomeProcedure" indirectly
mov eax, SomeProcedure
call eax ; call "SomeProcudure" directly/indirectly
call SomeProcedure ; call "SomeProcedure"
align 32
SomeTable:
dd 0x00000000 ; Entry 0
dd 0x00000000 ; Entry 1
dd SomeProcedure ; Entry 2
dd 0x00000000 ; Entry 3
dd 0x00000000 ; Entry 4
dd 0x00000000 ; Entry 5
dd 0x00000000 ; Entry 6
dd 0x00000000 ; Entry 7
SomeProcedure:
ret ;near return works for all calls above
Code: Select all
Address Instructions Assembly Comments
00000000 B8 20 00 00 00 mov eax, 0x00000020 absolute address of SomeTable
00000005 FF 50 08 call dword [eax+0x08] call absolute address stored at Entry 2
00000008 B8 40 00 00 00 mov eax, 0x00000040 absolute address of SomeProcedure
0000000D FF D0 call eax call absolute address stored in eax
0000000F E8 2C 00 00 00 call +0x0000002C relative displacement 0x0000002C
SomeTable
00000020 00 00 00 00 - Entry 0
00000024 00 00 00 00 - Entry 1
00000028 40 00 00 00 - Entry 2 (absolute address of SomeProcedure)
0000002C 00 00 00 00 - Entry 3
00000030 00 00 00 00 - Entry 4
00000034 00 00 00 00 - Entry 5
00000038 00 00 00 00 - Entry 6
0000003C 00 00 00 00 - Entry 7
00000040 C3 ret SomeProcedure instruction
But does it seem to you that the following code is an indirection of any kind?Octocontrabass wrote:Direct: the destination address is part of the instruction.Indirect: the destination address is not part of the instruction.Code: Select all
CALL thing
Seems pretty straightforward to me.Code: Select all
MOV EAX, thing CALL EAX
Code: Select all
MOV EAX, EBX
And for those who study assembly it is a source of mistakes.Antti wrote:Practically, it is more direct than indirect.
Code: Select all
MOV EAX, 8 ;Move immediate
CALL 8 ;Direct call
MOV EAX, EBX ;Move register
CALL EBX ;Indirect call register
MOV EAX, [8] ;Move direct
CALL [8] ;Indirect call direct
MOV EAX, [EBX] ;Move register indirect
CALL [EBX] ;Indirect call register indirect