From 38c74189625b4ab59f49ce795c887a46b8fdbd3d Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Wed, 16 Apr 2003 22:39:42 +0000 Subject: 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. --- xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c | 7 ------- xenolinux-2.4.21-pre4-sparse/include/asm-xeno/system.h | 14 ++++++++++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c index 4dc1273c7b..d4db667474 100644 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c @@ -369,13 +369,6 @@ void __switch_to(struct task_struct *prev_p, struct task_struct *next_p) execute_multicall_list(); __sti(); - /* - * Save away %fs and %gs. No need to save %es and %ds, as - * those are always kernel segments while inside the kernel. - */ - asm volatile("movl %%fs,%0":"=m" (*(int *)&prev->fs)); - asm volatile("movl %%gs,%0":"=m" (*(int *)&prev->gs)); - /* * Restore %fs and %gs. */ diff --git a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/system.h b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/system.h index 387ac0fdad..629c9d756b 100644 --- a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/system.h +++ b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/system.h @@ -10,10 +10,16 @@ #ifdef __KERNEL__ -struct task_struct; /* one of the stranger aspects of C forward declarations.. */ -extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next)); - -#define prepare_to_switch() do { } while(0) +struct task_struct; +extern void FASTCALL(__switch_to(struct task_struct *prev, + struct task_struct *next)); + +#define prepare_to_switch() \ +do { \ + struct thread_struct *__t = ¤t->thread; \ + __asm__ __volatile__ ( "movl %%fs,%0" : "=m" (*(int *)&__t->fs) ); \ + __asm__ __volatile__ ( "movl %%gs,%0" : "=m" (*(int *)&__t->gs) ); \ +} while (0) #define switch_to(prev,next,last) do { \ asm volatile("pushl %%esi\n\t" \ "pushl %%edi\n\t" \ -- cgit v1.2.3