On Fri, Jun 10, 2011 at 15:09, Mathias Krause <minipli@xxxxxxxxxxxxxx> wrote:
The address limit is already set in flush_old_exec() so those calls to set_fs(USER_DS) are redundant. Signed-off-by: Mathias Krause <minipli@xxxxxxxxxxxxxx> Cc: Greg Ungerer <gerg@xxxxxxxxxxx> --- Note: I'm not sure about the assignment to current->thread.fs in flush_thread() -- shouldn't this be done in set_fs() itself?
set_fs() is used to temporary set the address space to be used from the kernel. current->thread.fs is the address space that will be used when the thread returns to userspace. So I think it's correct. For nommu, thread.fs is set, but not really used.
Âarch/m68k/include/asm/processor.h |  Â4 ---- Âarch/m68k/kernel/process_mm.c   |  Â2 +- Âarch/m68k/kernel/process_no.c   |  Â2 +- Â3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h index f111b02..d8ef53a 100644 --- a/arch/m68k/include/asm/processor.h +++ b/arch/m68k/include/asm/processor.h @@ -105,9 +105,6 @@ struct thread_struct { Âstatic inline void start_thread(struct pt_regs * regs, unsigned long pc,                Âunsigned long usp) Â{ -    /* reads from user space */ -    set_fs(USER_DS); -    Âregs->pc = pc;    Âregs->sr &= ~0x2000;    Âwrusp(usp); @@ -129,7 +126,6 @@ extern int handle_kernel_fault(struct pt_regs *regs); Â#define start_thread(_regs, _pc, _usp)         Â\ Âdo {                          Â\ -    set_fs(USER_DS); /* reads from user space */  Â\    Â(_regs)->pc = (_pc);              Â\    Â((struct switch_stack *)(_regs))[-1].a6 = 0;  Â\    Âreformat(_regs);                Â\ diff --git a/arch/m68k/kernel/process_mm.c b/arch/m68k/kernel/process_mm.c index c2a1fc2..1bc223a 100644 --- a/arch/m68k/kernel/process_mm.c +++ b/arch/m68k/kernel/process_mm.c @@ -185,7 +185,7 @@ EXPORT_SYMBOL(kernel_thread); Âvoid flush_thread(void) Â{    Âunsigned long zero = 0; -    set_fs(USER_DS); +    Âcurrent->thread.fs = __USER_DS;    Âif (!FPU_IS_EMU)        Âasm volatile (".chip 68k/68881\n\t" diff --git a/arch/m68k/kernel/process_no.c b/arch/m68k/kernel/process_no.c index 9b86ad1..69c1803 100644 --- a/arch/m68k/kernel/process_no.c +++ b/arch/m68k/kernel/process_no.c @@ -158,7 +158,7 @@ void flush_thread(void) Â#ifdef CONFIG_FPU    Âunsigned long zero = 0; Â#endif -    set_fs(USER_DS); +    Âcurrent->thread.fs = __USER_DS; Â#ifdef CONFIG_FPU    Âif (!FPU_IS_EMU)
Gr{oetje,eeting}s, Â Â Â Â Â Â Â Â Â Â Â Â Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. Â Â Â Â Â Â Â Â Â Â Â Â Â ÂÂ ÂÂ -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html