[fpc-devel] threadvar implementation

Michael Schnell mschnell at lumino.de
Thu Jul 29 16:14:08 CEST 2010


I checked gcc for the NIOS processor.

Same has 32 general purpose registers (similar to ARM) Here <R26>+offset 
is used to access any global (and static) variables, while <R23>+offset 
is used to access any threadvars. Obviously the OS just sees that these 
registers (like all others) are preemption-safe while the program is 
running. I don't know how the initial values of there registers are set 
(by the OS or by the program/thread initialization RTL function).

I suppose with this paradigm, pointers to threadvars should work (other 
than with X86/32-Linux), as the threadvars - other than with X86 - 
simply have have different effective user space addresses with the 
different threads they are used in. Thus even cross-thread usage of 
pointers to threadvars would be consistent (other then with X86/32 Linux 
and Windows).


More information about the fpc-devel mailing list