How is the implicit segment register of a near pointer determined?
        Posted  
        
            by Daniel Trebbien
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Daniel Trebbien
        
        
        
        Published on 2010-05-20T21:14:11Z
        Indexed on 
            2010/05/20
            21:30 UTC
        
        
        Read the original article
        Hit count: 201
        
In section 4.3 of Intel 64® and IA-32 Architectures Software Developer's Manual. Volume 1: Basic Architecture, it says:
A near pointer is a 32-bit offset ... within a segment. Near pointers are used for all memory references in a flat memory model or for references in a segmented model where the identity of the segment being accessed is implied.
This leads me to wondering: how is the implied segment register determined?
I know that (%eip) and displaced (%eip) (e.g. -4(%eip)) addresses use %cs by default, and that (%esp) and displaced (%esp) addresses use %ss, but what about (%eax), (%edx), (%edi), (%ebp) etc., and can the implicit segment register depend also on the instruction that the memory address operand appears in?
© Stack Overflow or respective owner