Calling a procedure that exists in another code segment

jj1984

Member
Hello,

For Intel systems:

If you call a procedure that exists in the same code segment in which the calling procedure exists, the hardware will push the instruction pointer for the next instruction after the call instruction on the top of the stack using whatever segment you have currently designated as the stack segment.

But, if you call a procedure that exists in another code segment, will the hardware push the entire far pointer on the stack like it would a near pointer?

That is, will the hardware automatically push both the segment selector for the calling procedure's segment and the offset within that segment for the next instruction after the call instruction on the top of the stack?

Thanks.
 
Last edited:

jj1984

Member
They work differently in real and protected mode.

Yes, well I suppose that the first takes a simple 16-bit address for a segment base and the second takes a pointer to a descriptor in a descriptor table that contains the segment base within it.

Thanks for your reply.
 
Top