aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/kernel/ptrace.c')
-rw-r--r--arch/blackfin/kernel/ptrace.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index 140bf00e997..d2d38853663 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -45,6 +45,7 @@
45#include <asm/asm-offsets.h> 45#include <asm/asm-offsets.h>
46#include <asm/dma.h> 46#include <asm/dma.h>
47#include <asm/fixed_code.h> 47#include <asm/fixed_code.h>
48#include <asm/mem_map.h>
48 49
49#define TEXT_OFFSET 0 50#define TEXT_OFFSET 0
50/* 51/*
@@ -80,10 +81,12 @@ static inline struct pt_regs *get_user_regs(struct task_struct *task)
80/* 81/*
81 * Get all user integer registers. 82 * Get all user integer registers.
82 */ 83 */
83static inline int ptrace_getregs(struct task_struct *tsk, void __user * uregs) 84static inline int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
84{ 85{
85 struct pt_regs *regs = get_user_regs(tsk); 86 struct pt_regs regs;
86 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; 87 memcpy(&regs, get_user_regs(tsk), sizeof(regs));
88 regs.usp = tsk->thread.usp;
89 return copy_to_user(uregs, &regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
87} 90}
88 91
89/* Mapping from PT_xxx to the stack offset at which the register is 92/* Mapping from PT_xxx to the stack offset at which the register is
@@ -220,8 +223,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
220 break; 223 break;
221 pr_debug("ptrace: user address is valid\n"); 224 pr_debug("ptrace: user address is valid\n");
222 225
223 if (L1_CODE_LENGTH != 0 && addr >= L1_CODE_START 226 if (L1_CODE_LENGTH != 0 && addr >= get_l1_code_start()
224 && addr + sizeof(tmp) <= L1_CODE_START + L1_CODE_LENGTH) { 227 && addr + sizeof(tmp) <= get_l1_code_start() + L1_CODE_LENGTH) {
225 safe_dma_memcpy (&tmp, (const void *)(addr), sizeof(tmp)); 228 safe_dma_memcpy (&tmp, (const void *)(addr), sizeof(tmp));
226 copied = sizeof(tmp); 229 copied = sizeof(tmp);
227 230
@@ -300,8 +303,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
300 break; 303 break;
301 pr_debug("ptrace: user address is valid\n"); 304 pr_debug("ptrace: user address is valid\n");
302 305
303 if (L1_CODE_LENGTH != 0 && addr >= L1_CODE_START 306 if (L1_CODE_LENGTH != 0 && addr >= get_l1_code_start()
304 && addr + sizeof(data) <= L1_CODE_START + L1_CODE_LENGTH) { 307 && addr + sizeof(data) <= get_l1_code_start() + L1_CODE_LENGTH) {
305 safe_dma_memcpy ((void *)(addr), &data, sizeof(data)); 308 safe_dma_memcpy ((void *)(addr), &data, sizeof(data));
306 copied = sizeof(data); 309 copied = sizeof(data);
307 310