Skip to contentSkip to conversation

AVR32: Implement utrace support

PATCH New Haavard Skinnemoen 1 participant 1 message Mar 12, 2007 ptrace support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 AVR32: Implement utrace support

From: Haavard Skinnemoen <[email protected]>

Rip out most of the ptrace code for AVR32 and replace it with the much nicer utrace stuff. It builds in all possible combinations of CONFIG_UTRACE and CONFIG_PTRACE, and it seems to work as far as I've tested it with strace and some simple debugging with gdb.

---
 arch/avr32/kernel/entry-avr32b.S |   10 +-
 arch/avr32/kernel/process.c      |    2 -
 arch/avr32/kernel/ptrace.c       |  324 ++++++++++---------------------------
 include/asm-avr32/tracehook.h    |   69 ++++++++
 4 files changed, 165 insertions(+), 240 deletions(-)
arch/avr32/kernel/entry-avr32b.S +8 -2
index eeb6679..81eaf20 100644
@@ -229,15 +229,21 @@ ret_from_fork:
 	rjmp    syscall_exit_cont
 
 syscall_trace_enter:
-	pushm	r8-r12
+	mov	r12, sp		/* regs		*/
+	mov	r11, 0		/* is_exit	*/
 	rcall	syscall_trace
-	popm	r8-r12
+
+	/* syscall_trace may update r8, so reload r8-r12 from regs. */
+	sub	lr, sp, -REG_R12
+	ldm	lr, r8-r12
 	rjmp	syscall_trace_cont
 
 syscall_exit_work:
 	bld	r1, TIF_SYSCALL_TRACE
 	brcc	1f
 	unmask_interrupts
+	mov	r12, sp
+	mov	r11, 1
 	rcall	syscall_trace
 	mask_interrupts
 	ld.w	r1, r0[TI_flags]
arch/avr32/kernel/process.c +0 -2
index 0b43259..f7cf378 100644
@@ -229,8 +229,6 @@ asmlinkage int sys_execve(char __user *ufilename, char __user *__user *uargv,
 		goto out;
 
 	error = do_execve(filename, uargv, uenvp, regs);
-	if (error == 0)
-		current->ptrace &= ~PT_DTRACE;
 	putname(filename);
 
 out:
arch/avr32/kernel/ptrace.c +88 -236

382 lines not on this page · raw message

include/asm-avr32/tracehook.h new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
1.4.4.4