Re: [PATCH] m68k, exec: remove redundant set_fs(USER_DS)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux