[fpc-devel] OO rewrite - technical questions

Michael Schnell mschnell at lumino.de
Mon Jul 26 12:00:24 CEST 2010

  On 07/26/2010 11:41 AM, Sven Barth wrote:
> Win64 uses GS instead of FS for the TEB and everything else stays the 
> same. In fact FS and GS (and to some extend CS) are the only selectors 
> actively used by the x86_64 platform, but - if I understand that 
> correctly - they can only be set up from ring 0 code (thus: kernel 
> code), which normally happens during context switches so that the data 
> of the current thread's TEB is available again.

OK. Supposedly, Win64 - like Win32 - use the same GS value for all 
threads and different tables this selector points to. But this is not 
relevant to the compiler or ASM programmer as it yields the same effect. 
Supposedly, the compiler does not ever need to write to FS/GS not the 
the table they select from, so no problem here.

But the question remains why - as stated above by the FPC team - trying 
to use GS in this way, did not seem to work reliably on Win64.


More information about the fpc-devel mailing list