Skip to content
Snippets Groups Projects
  • Graeme Russ's avatar
    9e6c572f
    x86: Use fs for global data · 9e6c572f
    Graeme Russ authored
    Use the base address of the 'F' segment as a pointer to the global data
    structure. By adding the linear address (i.e. the 'D' segment address) as
    the first word of the global data structure, the address of the global data
    relative to the 'D' segment can be found simply, for example, by:
    
    	fs movl 0, %eax
    
    This makes the gd 'pointer' writable prior to relocation (by reloading the
    Global Desctriptor Table) which brings x86 into line with all other arches
    
    NOTE: Writing to the gd 'pointer' is expensive (but we only do it
    twice) but using it to access global data members (read and write) is
    still fairly cheap
    
    --
    Changes for v2:
     - Rebased against changes made to patch #3
     - Removed extra indent
     - Tweaked commit message
    9e6c572f
    History
    x86: Use fs for global data
    Graeme Russ authored
    Use the base address of the 'F' segment as a pointer to the global data
    structure. By adding the linear address (i.e. the 'D' segment address) as
    the first word of the global data structure, the address of the global data
    relative to the 'D' segment can be found simply, for example, by:
    
    	fs movl 0, %eax
    
    This makes the gd 'pointer' writable prior to relocation (by reloading the
    Global Desctriptor Table) which brings x86 into line with all other arches
    
    NOTE: Writing to the gd 'pointer' is expensive (but we only do it
    twice) but using it to access global data members (read and write) is
    still fairly cheap
    
    --
    Changes for v2:
     - Rebased against changes made to patch #3
     - Removed extra indent
     - Tweaked commit message