Re: Why SAVE_ALL (for x86) macro in 2.6 loads __USER_DS to %ds

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

 



Hi,

These are the definitions of __KERNEL_DS and __USER_DS:
#define __KERNEL_DS     (GDT_ENTRY_KERNEL_DS * 8)
#define __USER_DS     (GDT_ENTRY_DEFAULT_USER_DS* 8 + 3)

The difference is firstly in the privilege level ("+ 3"). There also
is a comment in the same file (arch/x86/include/asm/segment.h):
/*
 * we cannot use the same code segment descriptor for user and kernel
 * -- not even in the long flat mode, because of different DPL /kkeil
 * The segment offset needs to contain a RPL. Grr. -AK
 * GDT layout to get 64bit syscall right (sysret hardcodes gdt offsets)
 */



2010/6/8 rahul dev <rahul_dev_agg@xxxxxxxxxxx>:
> Hi Joel,
>
> <snip>
>
>> since Linux doesn't use segmentation , all the segment descriptor values > are the same. So I think it doesn't matter what selector value you load > in DS, ES etc. Though I don't know the real reason for why __USER_DS  is > used instead of __KERNEL_DS
>
> Although, linux doesn't use segmentation, but I believe the DPL values are different for user and kernel data segment descriptor. Please correct me if I am wrong.
>
> thanks,
> rahul
>
>
>
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>



-- 
Alexander Potashev

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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