On Thursday 10 February 2005 12:42, [EMAIL PROTECTED] wrote: > > Also, the code inside UML should absolutely support it (from the code I > > don't > > see any problem), at least for the x86 UML. > > modify_ldt is a x86 syscall aswell, so it will only appear in x86/x86_64 > umls. Yes, agreed... x86 UML supports it, but x86_64 UML does not (yet). I maybe was not clear that this is a missing feature, or a bug, or a put-another-name-for-ants-wasps-and-such-here.
Jeff stated that in 64-bit UML the 32-bit compatibility code is still gross (in fact he hasn't yet started merging it). However, the GDT/LDT on x86_64 have a reduced role.... maybe they are supported in the 32-bit userspace / 64-bit kernel case, but surely not for the pure 64-bit case (wonder how TLS is done there). > It was implemented and used by dosemu project originally. > What actually uses this syscall as I find the syscall to be badly > documented last time I looked at it. The TLS code... (Thread Local Storage). In short, if you put a certain value in the (let's say) ES (or FS, or GS) register (they are segment selectors), it can point to an entry in the LDT (which you create with modify_ldt). It means that if I read the address NNNN inside the ES segment (in assembler ES:NNNN in Intel notation), it will point to the NNNN address inside the segment (i.e. you have one "base address" to add to NNNN which can be != 0). Normal reads are done from the DS (for Data) and CS (for code) segments. Now, if you switch the entry number in ES for each thread (probably this is done at startup and we rely on nobody else modifying the ES value, which is a valid guarantee), you get that each thread, with ES:NNNN, will access a different var (by creating one area for each thread and putting the base addresses of these areas inside various LDT entries). I can confirm glibc uses modify_ldt() for TLS support on LinuxThreads. With NPTL, they use 2.6 host kernel support - instead of having 8192 maximum thread number (because this is the size of the LDT), one entry of the GDT is used, and for each task the kernel saves the appropriate segment descriptor. -- Paolo Giarrusso, aka Blaisorblade Linux registered user n. 292729 http://www.user-mode-linux.org/~blaisorblade ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel