direct-io.hg

changeset 374:61b0ce463488

bitkeeper revision 1.177 (3e9ddbaeZvT8WLJjkXqctK8YH2xb1A)

system.h, process.c:
Fixed Xenolinux context switch code so that FS and GS are properly saved for the old process.
author kaf24@scramble.cl.cam.ac.uk
date Wed Apr 16 22:39:42 2003 +0000 (2003-04-16)
parents c3eb2a837ee5
children cece37ee4eab
files xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c xenolinux-2.4.21-pre4-sparse/include/asm-xeno/system.h
line diff
     1.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c	Wed Apr 16 18:44:11 2003 +0000
     1.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c	Wed Apr 16 22:39:42 2003 +0000
     1.3 @@ -370,13 +370,6 @@ void __switch_to(struct task_struct *pre
     1.4      __sti();
     1.5  
     1.6      /*
     1.7 -     * Save away %fs and %gs. No need to save %es and %ds, as
     1.8 -     * those are always kernel segments while inside the kernel.
     1.9 -     */
    1.10 -    asm volatile("movl %%fs,%0":"=m" (*(int *)&prev->fs));
    1.11 -    asm volatile("movl %%gs,%0":"=m" (*(int *)&prev->gs));
    1.12 -
    1.13 -    /*
    1.14       * Restore %fs and %gs.
    1.15       */
    1.16      loadsegment(fs, next->fs);
     2.1 --- a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/system.h	Wed Apr 16 18:44:11 2003 +0000
     2.2 +++ b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/system.h	Wed Apr 16 22:39:42 2003 +0000
     2.3 @@ -10,10 +10,16 @@
     2.4  
     2.5  #ifdef __KERNEL__
     2.6  
     2.7 -struct task_struct;	/* one of the stranger aspects of C forward declarations.. */
     2.8 -extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
     2.9 +struct task_struct;
    2.10 +extern void FASTCALL(__switch_to(struct task_struct *prev, 
    2.11 +                                 struct task_struct *next));
    2.12  
    2.13 -#define prepare_to_switch()	do { } while(0)
    2.14 +#define prepare_to_switch()                                             \
    2.15 +do {                                                                    \
    2.16 +    struct thread_struct *__t = &current->thread;                       \
    2.17 +    __asm__ __volatile__ ( "movl %%fs,%0" : "=m" (*(int *)&__t->fs) );  \
    2.18 +    __asm__ __volatile__ ( "movl %%gs,%0" : "=m" (*(int *)&__t->gs) );  \
    2.19 +} while (0)
    2.20  #define switch_to(prev,next,last) do {					\
    2.21  	asm volatile("pushl %%esi\n\t"					\
    2.22  		     "pushl %%edi\n\t"					\