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]

 



Guys,

  I was looking at the SAVE_ALL code for kernel 2.6.
I am confused why SAVE_ALL restores __USER_DS to ds and es ?

#define SAVE_ALL \
	cld; \
	pushl %fs; \
	pushl %es; \
	pushl %ds; \
	pushl %eax; \
	pushl %ebp; \
	pushl %edi; \
	pushl %esi; \
	pushl %edx; \
	pushl %ecx; \
	pushl %ebx; \
	movl $(__USER_DS), %edx; \   <---- why __USER_DS ?
	movl %edx, %ds; \
	movl %edx, %es; \
	movl $(__KERNEL_PDA), %edx; \
	movl %edx, %fs


If you look at the linux 2.4, it restores __KERNEL_DS in SAVE_ALL.
#define SAVE_ALL \
        cld; \
        pushl %es; \
        pushl %ds; \
        pushl %eax; \
        pushl %ebp; \
        pushl %edi; \
        pushl %esi; \
        pushl %edx; \
        pushl %ecx; \
        pushl %ebx; \
        movl $(__KERNEL_DS),%edx; \     <-- __KERNEL_DS is restored here.
        movl %edx,%ds; \
        movl %edx,%es;

Does anyone know why do we restore __USER_DS on context switch from user to kernel instead of __KERNEL_DS ?

thanks a lot for any help ...




--
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