Re: about default_ldt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },
>                 { 0, 0 }, { 0, 0 } };
> why does default_ldt have five elements?
> why this size?  5*sizeof(desc_struct)

I can't find exact explanation, however I saw this in trap_init() in 
arch/i386/kernel/traps.c (kernel 2.4.20):

#if 0
set_call_gate(&default_ldt[0],lcall7);
set_call_gate(&default_ldt[4],lcall27);
#endif 0

So, seems like "5" is a magic number to support some archaic 
requirements, since I can't find similar one in 2.6.x series (to be 
precise, 2.6.11.1)

IIRC, LDT was used to support non-NPTL based LinuxThreads, since it 
creates segments in LDT and created in process-wide style (all threads 
in same thread group refer to different LDT entry in the same LDT 
table). But now, the segments are created/updated in GDT (i am talking 
about TLS) since TLS entry are made per thread.

LDT is also used in Wine, since Windows applications assume segmentation 
during runtime, but I don't know the detail. Maybe this isn't true for 
latest Windows version (NT above) since many OS are now using flat 
addresing and rely more in paging mechanism.

Somebody, please CMIIW.

regards,

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux