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 ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to