Commit 7786ce82 authored by Jie Zhang's avatar Jie Zhang Committed by Bryan Wu

Blackfin arch: fix bug - gdb signull case make trunk kernel panic frequently

Use copy_to_user_page and copy_from_user_page instead of
memcpy. copy_to_user_page does cache flush when necessary.
Signed-off-by: default avatarJie Zhang <jie.zhang@analog.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
parent 27276ba2
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/fixed_code.h> #include <asm/fixed_code.h>
#include <asm/cacheflush.h>
#include <asm/mem_map.h> #include <asm/mem_map.h>
#define TEXT_OFFSET 0 #define TEXT_OFFSET 0
...@@ -240,7 +241,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -240,7 +241,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
} else if (addr >= FIXED_CODE_START } else if (addr >= FIXED_CODE_START
&& addr + sizeof(tmp) <= FIXED_CODE_END) { && addr + sizeof(tmp) <= FIXED_CODE_END) {
memcpy(&tmp, (const void *)(addr), sizeof(tmp)); copy_from_user_page(0, 0, 0, &tmp, (const void *)(addr), sizeof(tmp));
copied = sizeof(tmp); copied = sizeof(tmp);
} else } else
...@@ -320,7 +321,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -320,7 +321,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
} else if (addr >= FIXED_CODE_START } else if (addr >= FIXED_CODE_START
&& addr + sizeof(data) <= FIXED_CODE_END) { && addr + sizeof(data) <= FIXED_CODE_END) {
memcpy((void *)(addr), &data, sizeof(data)); copy_to_user_page(0, 0, 0, (void *)(addr), &data, sizeof(data));
copied = sizeof(data); copied = sizeof(data);
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment