x86: CALL address in an executable? 
Author Message
 x86: CALL address in an executable?

In an x86 program, if you look at the hex of an EXE there is an E8 for
a call... but how is the address its calling determined?  I'm wondering
because more than one call to the same routine (address) yields a
different address for each call.

I know there is an equation related to the current offset, but what
next?

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sat, 27 Jul 2002 03:00:00 GMT  
 x86: CALL address in an executable?

Quote:

>In an x86 program, if you look at the hex of an EXE there is an E8 for
>a call

E8 for a near call where an offset is immediately provided. There are
other ways to call, such as register indirect/memory indirect,
intersegment calls to a full pointer immediately provided, call gates,
etc. These have an FF or 9A opcode.

Quote:
>... but how is the address its calling determined?  I'm wondering
>because more than one call to the same routine (address) yields a
>different address for each call.

All the calls to the same location, necesarily generate the same code;
unless the CS register has been changed in some way between calls.
Say,

        CS = NewSegment

In which case, the offset of the routine, relative to CS, has changed,
and this is reflected in the generated code.

But, then the source code needs include an

        ASSUME CS:NewSegment

directive (MASM/TASM), so that the assembler may evaluate the offsets
from the NewSegment starting point.

If CS has not changed between calls, differences in generated code
must surely lead to calls to different routines each time.

Manuel Algora



Sun, 28 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. siod x86 executable ftpable?

2. Call a REXX Exec and have it Address the calling program

3. need addresses of variables in gnat-executable

4. Modulo addressing with the x86

5. Calling executable from awk script

6. calling DOS executable within VW 2.0

7. Tool Bar calling executable

8. old as a prefix to function calls and in executable code

9. Problem with dynamic call of sub VI in executable in LV 6

10. Problem with dynamic call of sub VI in executable in LV 6

11. Calling executable from REXX exec.....

12. Call for Papers for a Special Issue of Computer on Executable Content

 

 
Powered by phpBB® Forum Software