Re: doubt ?

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

 



On Mon, 2 Sep 2002 22:25:55 +0200
Jan Hudec <bulb@cimice.maxinet.cz> wrote:

>On Mon, Sep 02, 2002 at 04:03:21PM +0200, Angelo Dell'Aera wrote:
>> AFAIK Linux creates at boot time some segments.
>> 
>> -two for kernel : kernel data segment and kernel code segment;
>> -two for userland : user data segment and user code segment
>> 	(this last ones are shared by all processes in User Mode);
>> -in Linux 2.2 a task state segment (TSS) for each process, in 
>>  Linux 2.4 simply one TSS per CPU;
>> -a default Local Descriptor Table segment usually shared by all
>>  processes (but very rarely used).
>
>Segments are kind of superfluous for linux. They are superseeded by
>paging, but ia32 insists on still using them. So there is as little of
>them as possible.

True. Infact Linux prefers paging since it guarantees portability to
other archs which support segmentation in a very limited way. Btw in
kernel sources (/usr/src/linux/include/asm-i386/sched.h) I found
this...maybe it could be useful. Obviously it refers only to i386.

 * The layout of the GDT under Linux:
 *
 *   0 - null
 *   1 - not used
 *   2 - kernel code segment
 *   3 - kernel data segment
 *   4 - user code segment                  <-- new cacheline
 *   5 - user data segment
 *   6 - not used
 *   7 - not used
 *   8 - APM BIOS support                   <-- new cacheline
 *   9 - APM BIOS support
 *  10 - APM BIOS support
 *  11 - APM BIOS support
 *
 * The TSS+LDT descriptors are spread out a bit so that every CPU
 * has an exclusive cacheline for the per-CPU TSS and LDT:
 *
 *  12 - CPU#0 TSS                          <-- new cacheline
 *  13 - CPU#0 LDT
 *  14 - not used
 *  15 - not used
 *  16 - CPU#1 TSS                          <-- new cacheline
 *  17 - CPU#1 LDT 
 *  18 - not used
 *  19 - not used
 *  ... NR_CPUS per-CPU TSS+LDT's if on SMP
 
Regards,

Angelo Dell'Aera 'buffer' 
<buffer@users.sourceforge.net>
--
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