[PATCH] i386: Use %gs as the PDA base-segment in the kernel
This patch is the meat of the PDA change. This patch makes several related changes: 1: Most significantly, %gs is now used in the kernel. This means that on entry, the old value of %gs is saved away, and it is reloaded with __KERNEL_PDA. 2: entry.S constructs the stack in the shape of struct pt_regs, and this is passed around the kernel so that the process's saved register state can be accessed. Unfortunately struct pt_regs doesn't currently have space for %gs (or %fs). This patch extends pt_regs to add space for gs (no space is allocated for %fs, since it won't be used, and it would just complicate the code in entry.S to work around the space). 3: Because %gs is now saved on the stack like %ds, %es and the integer registers, there are a number of places where it no longer needs to be handled specially; namely context switch, and saving/restoring the register state in a signal context. 4: And since kernel threads run in kernel space and call normal kernel code, they need to be created with their %gs == __KERNEL_PDA. Signed-off-by:Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by:
Andi Kleen <ak@suse.de> Cc: Chuck Ebbert <76306.1226@compuserve.com> Cc: Zachary Amsden <zach@vmware.com> Cc: Jan Beulich <jbeulich@novell.com> Cc: Andi Kleen <ak@suse.de> Signed-off-by:
Andrew Morton <akpm@osdl.org>
Showing
- arch/i386/kernel/asm-offsets.c 1 addition, 0 deletionsarch/i386/kernel/asm-offsets.c
- arch/i386/kernel/cpu/common.c 19 additions, 2 deletionsarch/i386/kernel/cpu/common.c
- arch/i386/kernel/entry.S 48 additions, 22 deletionsarch/i386/kernel/entry.S
- arch/i386/kernel/head.S 27 additions, 4 deletionsarch/i386/kernel/head.S
- arch/i386/kernel/process.c 12 additions, 14 deletionsarch/i386/kernel/process.c
- arch/i386/kernel/signal.c 2 additions, 4 deletionsarch/i386/kernel/signal.c
- include/asm-i386/mmu_context.h 2 additions, 2 deletionsinclude/asm-i386/mmu_context.h
- include/asm-i386/processor.h 3 additions, 1 deletioninclude/asm-i386/processor.h
- include/asm-i386/ptrace.h 2 additions, 0 deletionsinclude/asm-i386/ptrace.h
- kernel/fork.c 1 addition, 1 deletionkernel/fork.c
Loading
Please register or sign in to comment