[fpc-devel] OO rewrite - technical questions

Sven Barth pascaldragon at googlemail.com
Tue Jul 20 12:51:52 CEST 2010


Hi!

Am 20.07.2010 11:31, schrieb Michael Schnell:
> On 07/19/2010 08:33 PM, Hans-Peter Diettrich wrote:
>>
>> Windows uses segment registers in exception handling, i.e. it should
>> be possible. But the segment descriptor/selector must point to the
>> correct thread-memory address in the address space, what can not be
>> achieved in application code.
>>
> If Windows sets the segment registers and the application is not
> supposed to modify them (and assume them to be restored after
> preemption), maybe one of them is a pointer to some thread-dedicated
> memory area, that by can be used (or is used by the OS) to hold a
> pointer to the threadvars or to hold the threadvars themselves (if the
> size of the threadvar area is denoted in the exe file and thus known to
> the OS, which might kindly allocate it when a thread is created).

According to 
http://en.wikipedia.org/wiki/Thread-local_storage#Windows_implementation 
you use a dedicated API to modify the TLS. And according to 
http://en.wikipedia.org/wiki/Thread_Environment_Block the address of the 
TLS is indeed accessible/saved in the segment registers.

Regards,
Sven



More information about the fpc-devel mailing list