X86 Build Instructions: call * Reg

Can someone give me some information about indirect function calls in x86 assembly, i.e. instructions like

call *Reg 

So where is the address of the function label stored in the register. Somehow I could not find information about this through google.

And besides, what does it mean if I get a Trace / breakpoint exception when I run the x86 build program that has such an instruction?

+7
source share
1 answer

Intel and AMD publish very good x86 documentation. Here's a link to an Intels instruction set statement, which (of course) has a section on CALL. http://www.intel.com/design/intarch/manuals/243191.HTM

 OP Code: FF /2 Instruction: CALL r/m32 Description: Call near, absolute indirect, address given in r/m32 

Using NASM Syntax

 lbl_start: MOV EAX, lbl_function1 CALL EAX RETN lbl_function1: MOV EAX, 1 RET 0 

If you get an exception, that could mean almost everything. Here are some common problems ...

  • you do not set the register to an address inside the program
    • you set the value of the register, but it changes when you call the API that happens before your CALL reg32
    • you set a register value for data located at a specific address, not the address itself
  • You are not correctly encoding your CALL reg32 OP code (for example: FF D0 - CALL EAX in hexadecimal format)
+6
source

All Articles