patch-2.3.7 linux/arch/arm/kernel/ptrace.c

Next file: linux/arch/arm/kernel/setup.c
Previous file: linux/arch/arm/kernel/process.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.6/linux/arch/arm/kernel/ptrace.c linux/arch/arm/kernel/ptrace.c
@@ -34,11 +34,11 @@
  */
 static inline long get_stack_long(struct task_struct *task, int offset)
 {
-	unsigned char *stack;
+	struct pt_regs *regs;
 
-	stack = (unsigned char *)((unsigned long)task + 8192 - sizeof(struct pt_regs));
-	stack += offset << 2;
-	return *(unsigned long *)stack;
+	regs = (struct pt_regs *)((unsigned long)task + 8192 - sizeof(struct pt_regs));
+
+	return regs->uregs[offset];
 }
 
 /*
@@ -50,11 +50,12 @@
 static inline long put_stack_long(struct task_struct *task, int offset,
 	unsigned long data)
 {
-	unsigned char *stack;
+	struct pt_regs *regs;
+
+	regs = (struct pt_regs *)((unsigned long)task + 8192 - sizeof(struct pt_regs));
+
+	regs->uregs[offset] = data;
 
-	stack = (unsigned char *)((unsigned long)task + 8192 - sizeof(struct pt_regs));
-	stack += offset << 2;
-	*(unsigned long *) stack = data;
 	return 0;
 }
 
@@ -157,11 +158,16 @@
 	
 	if (MAP_NR(page) < max_mapnr) {
 		page += addr & ~PAGE_MASK;
+
+		flush_cache_range(vma->vm_mm, addr, addr + sizeof(unsigned long));
+
 		*(unsigned long *)page = data;
-		__flush_entry_to_ram(page);
+
+		clean_cache_area(page, sizeof(unsigned long));
+
+		set_pte(pgtable, pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
+		flush_tlb_page(vma, addr & PAGE_MASK);
 	}
-	set_pte(pgtable, pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
-	flush_tlb();
 }
 
 /*
@@ -343,8 +349,7 @@
 printk ("=%08lX ", val);
 	return val;
 }
-#undef pc_pointer
-#define pc_pointer(x) ((x) & 0x03fffffc)
+
 int ptrace_set_bpt (struct task_struct *child)
 {
 	unsigned long insn, pc, alt;
@@ -651,7 +656,6 @@
 				return 0;
 			wake_up_process (child);
 			child->exit_code = SIGKILL;
-			ptrace_cancel_bpt (child);
 			/* make sure single-step breakpoint is gone. */
 			ptrace_cancel_bpt (child);
 			ret = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)