Skip to contentSkip to conversation

m68k: merge the mmu and non-mmu versions of ptrace.c

PATCH Superseded [email protected] 2 participants 4 messages Feb 7, 2012 – Feb 21, 2012

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68k: merge the mmu and non-mmu versions of ptrace.c

From: Greg Ungerer <[email protected]>

Most of the code in the non-mmu ptrace_no.c file is the same as the mmu version ptrace_mm.c. So merge them back into a single file.

---
 arch/m68k/kernel/{ptrace_mm.c => ptrace.c} |   12 +-
 arch/m68k/kernel/ptrace_no.c               |  255 ----------------------------
 2 files changed, 10 insertions(+), 257 deletions(-)
 rename arch/m68k/kernel/{ptrace_mm.c => ptrace.c} (96%)
 delete mode 100644 arch/m68k/kernel/ptrace_no.c
arch/m68k/kernel/ptrace.c renamed from arch/m68k/kernel/ptrace_mm.c +10 -2
similarity index 96%
rename from arch/m68k/kernel/ptrace_mm.c
rename to arch/m68k/kernel/ptrace.c
index 7bc999b..8cf89ed 100644
@@ -146,11 +146,13 @@ void user_enable_single_step(struct task_struct *child)
 	set_tsk_thread_flag(child, TIF_DELAYED_TRACE);
 }
 
+#ifdef CONFIG_MMU
 void user_enable_block_step(struct task_struct *child)
 {
 	unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS;
 	put_reg(child, PT_SR, tmp | T0_BIT);
 }
+#endif
 
 void user_disable_single_step(struct task_struct *child)
 {
@@ -181,6 +183,14 @@ long arch_ptrace(struct task_struct *child, long request,
 			if (FPU_IS_EMU && (regno < 45) && !(regno % 3))
 				tmp = ((tmp & 0xffff0000) << 15) |
 				      ((tmp & 0x0000ffff) << 16);
+#ifndef CONFIG_MMU
+		} else if (regno == 49) {
+			tmp = child->mm->start_code;
+		} else if (regno == 50) {
+			tmp = child->mm->start_data;
+		} else if (regno == 51) {
+			tmp = child->mm->end_code;
+#endif
 		} else
 			goto out_eio;
 		ret = put_user(tmp, datap);
@@ -277,7 +287,6 @@ asmlinkage void syscall_trace(void)
 	}
 }
 
-#ifdef CONFIG_COLDFIRE
 asmlinkage int syscall_trace_enter(void)
 {
 	int ret = 0;
@@ -292,4 +301,3 @@ asmlinkage void syscall_trace_leave(void)
 	if (test_thread_flag(TIF_SYSCALL_TRACE))
 		tracehook_report_syscall_exit(task_pt_regs(current), 0);
 }
-#endif /* CONFIG_COLDFIRE */
arch/m68k/kernel/ptrace_no.c deleted +0 -255

255 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 11 lines · On Tue, Feb 7, 2012 at 04:25, <[email protected]> wrote:
arch/m68k/kernel/ptrace.c renamed from arch/m68k/kernel/ptrace_mm.c +0 -1
@@ -277,7 +287,6 @@ asmlinkage void syscall_trace(void)
        }
  }
 
-#ifdef CONFIG_COLDFIRE
  asmlinkage int syscall_trace_enter(void)
  {
        int ret = 0;

arch/m68k/kernel/ptrace.c asmlinkage void syscall_trace_leave(void) · line 295

Quoted 4 lines
arch/m68k/kernel/ptrace.c renamed from arch/m68k/kernel/ptrace_mm.c +0 -1
@@ -292,4 +301,3 @@ asmlinkage void syscall_trace_leave(void)
        if (test_thread_flag(TIF_SYSCALL_TRACE))
                tracehook_report_syscall_exit(task_pt_regs(current), 0);
  }
-#endif /* CONFIG_COLDFIRE */

Why have you dropped the #ifdef?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

#2 lore raw

Hi Geert,

Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · On Tue, Feb 7, 2012 at 04:25,<[email protected]> wrote:
arch/m68k/kernel/ptrace.c renamed from arch/m68k/kernel/ptrace_mm.c +0 -0
@@ -277,7 +287,6 @@ asmlinkage void syscall_trace(void)
 	}
 }
 
Quoted 11 lines

arch/m68k/kernel/ptrace.c asmlinkage void syscall_trace_leave(void) · line 295

Quoted 9 lines
arch/m68k/kernel/ptrace.c renamed from arch/m68k/kernel/ptrace_mm.c +0 -2
-#ifdef CONFIG_COLDFIRE
 asmlinkage int syscall_trace_enter(void)
 {
 	int ret = 0;
@@ -292,4 +301,3 @@ asmlinkage void syscall_trace_leave(void)
 	if (test_thread_flag(TIF_SYSCALL_TRACE))
 		tracehook_report_syscall_exit(task_pt_regs(current), 0);
 }
-#endif /* CONFIG_COLDFIRE */

Why have you dropped the #ifdef?

Purely to have less "#ifdef"s in the code.
Does bloat the code a little, would you prefer I leave the #ifdef there?

Regards
Greg

------------------------------------------------------------------------

Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
#3 lore raw

Hi Greg,

Quoted 21 lines · Greg Ungerer
Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · On Tue, Feb 7, 2012 at 04:25,<[email protected]>  wrote:
arch/m68k/kernel/ptrace.c renamed from arch/m68k/kernel/ptrace_mm.c +0 -0
@@ -277,7 +287,6 @@ asmlinkage void syscall_trace(void)
        }
 }
 
Quoted 12 lines

arch/m68k/kernel/ptrace.c asmlinkage void syscall_trace_leave(void) · line 295

Quoted 9 lines
arch/m68k/kernel/ptrace.c renamed from arch/m68k/kernel/ptrace_mm.c +0 -2
-#ifdef CONFIG_COLDFIRE
 asmlinkage int syscall_trace_enter(void)
 {
        int ret = 0;
@@ -292,4 +301,3 @@ asmlinkage void syscall_trace_leave(void)
        if (test_thread_flag(TIF_SYSCALL_TRACE))
                tracehook_report_syscall_exit(task_pt_regs(current), 0);
 }
-#endif /* CONFIG_COLDFIRE */

Why have you dropped the #ifdef?

Quoted 1 line

Purely to have less "#ifdef"s in the code.

IC.

Quoted 1 line

Does bloat the code a little, would you prefer I leave the #ifdef there?

Yes, it serves as a reminder to add syscall trace support.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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