lkml.org 
[lkml]   [2011]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] m68k, exec: remove redundant set_fs(USER_DS)
From
On Fri, Jun 10, 2011 at 15:09, Mathias Krause <minipli@googlemail.com> 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@googlemail.com>
> Cc: Greg Ungerer <gerg@uclinux.org>
> ---
>
> 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@linux-m68k.org

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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-06-15 16:43    [W:0.240 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site