|
About ::
TODO ::
Blog ::
RSS ::
Old blog ::
Projects ::
GIT ::
Gallery ::
Notes
Sun, 11 Feb 2007
Some thoughts about M:N threading nad NPTL.
# define THREAD_SELF \
({ struct pthread *__self; \
asm ("movl %%gs:%c1,%0" : "=r" (__self) \
: "i" (offsetof (struct pthread, header.self))); \
__self;})
%gs itself shows to the descriptor in GDT, but it is always 51,
while GDT only holds 32 descriptors, %%cs for example contains 115 - one question
(the last minute though - GDT entries are of 8 bytes each, so it is possible, that
value stored in register should be divided to 8 to get actual entry... Will check out tomorrow.).Another one - what does it mean "%%gs:%c1" - it will be transferred
as "%%gs:immediate_parameter_1", i.e. "%%gs:some_num", for example
"%%gs:0" works, but it does not work with usual register like %%eax, only %%gs.
Similar access to %%cs, %%ds and other segment registers ends up with segmentation fault.It looks like walking in the dark room with exact knowledge that there is at least one rake... But I will find an exit soon. /devel/threading :: Link / Comments (0) Please solve this captcha to be allowed to post (need to reload in a minute): 48 * 43 Comments are closed for this story. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||