summaryrefslogtreecommitdiffstats
path: root/arch/score/kernel
diff options
context:
space:
mode:
authorChen Liqin <liqin.chen@sunplusct.com>2009-06-19 13:53:49 +0800
committerArnd Bergmann <arnd@arndb.de>2009-06-19 11:40:13 +0200
commit0402c91af944c61bf788370f03326959a35cb8be (patch)
tree1f522cec2d62050e7fcaed676005b7d43922276e /arch/score/kernel
parent6bcf67374137f433e85aa42a18fde9f0e8562901 (diff)
downloadop-kernel-dev-0402c91af944c61bf788370f03326959a35cb8be.zip
op-kernel-dev-0402c91af944c61bf788370f03326959a35cb8be.tar.gz
score: update files according to review comments
modified: arch/score/include/asm/cacheflush.h modified: arch/score/include/asm/delay.h modified: arch/score/include/asm/errno.h modified: arch/score/include/asm/pgtable-bits.h modified: arch/score/include/asm/pgtable.h modified: arch/score/include/asm/ptrace.h modified: arch/score/include/asm/unistd.h modified: arch/score/kernel/entry.S modified: arch/score/kernel/process.c modified: arch/score/kernel/ptrace.c modified: arch/score/kernel/signal.c modified: arch/score/kernel/sys_score.c modified: arch/score/kernel/traps.c modified: arch/score/mm/cache.c Signed-off-by: Chen Liqin <liqin.chen@sunplusct.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/score/kernel')
-rw-r--r--arch/score/kernel/entry.S6
-rw-r--r--arch/score/kernel/process.c2
-rw-r--r--arch/score/kernel/ptrace.c144
-rw-r--r--arch/score/kernel/signal.c6
-rw-r--r--arch/score/kernel/sys_score.c7
-rw-r--r--arch/score/kernel/traps.c2
6 files changed, 50 insertions, 117 deletions
diff --git a/arch/score/kernel/entry.S b/arch/score/kernel/entry.S
index 6c6b7ea..0af89b2 100644
--- a/arch/score/kernel/entry.S
+++ b/arch/score/kernel/entry.S
@@ -23,7 +23,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <linux/errno.h>
+#include <linux/err.h>
#include <linux/init.h>
#include <linux/linkage.h>
@@ -434,7 +434,7 @@ stack_done:
sw r8, [r0, PT_R7]
b 2f
1:
- cmpi.c r4, -EMAXERRNO-1 # -EMAXERRNO - 1=-1134
+ cmpi.c r4, -MAX_ERRNO - 1
ble 2f
ldi r8, 0x1;
sw r8, [r0, PT_R7]
@@ -466,7 +466,7 @@ syscall_trace_entry:
lw r7, [r0, PT_R7]
brl r8
- li r8, -EMAXERRNO - 1 # error?
+ li r8, -MAX_ERRNO - 1
sw r8, [r0, PT_R7] # set error flag
neg r4, r4 # error
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
index aaa3085..d93966f 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
@@ -56,7 +56,7 @@ void __noreturn cpu_idle(void)
}
}
-asmlinkage void ret_from_fork(void);
+void ret_from_fork(void);
void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp)
{
diff --git a/arch/score/kernel/ptrace.c b/arch/score/kernel/ptrace.c
index 8fe7209..19911e3 100644
--- a/arch/score/kernel/ptrace.c
+++ b/arch/score/kernel/ptrace.c
@@ -80,7 +80,35 @@ write_tsk_long(struct task_struct *child,
return copied != sizeof(val) ? -EIO : 0;
}
-void set_single_step(struct task_struct *child)
+/*
+ * Get all user integer registers.
+ */
+static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
+{
+ struct pt_regs *regs = task_pt_regs(tsk);
+
+ return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
+}
+
+/*
+ * Set all user integer registers.
+ */
+static int ptrace_setregs(struct task_struct *tsk, void __user *uregs)
+{
+ struct pt_regs newregs;
+ int ret;
+
+ ret = -EFAULT;
+ if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
+ struct pt_regs *regs = task_pt_regs(tsk);
+ *regs = newregs;
+ ret = 0;
+ }
+
+ return ret;
+}
+
+void user_enable_single_step(struct task_struct *child)
{
/* far_epc is the target of branch */
unsigned int epc, far_epc = 0;
@@ -201,7 +229,7 @@ void set_single_step(struct task_struct *child)
}
}
-void clear_single_step(struct task_struct *child)
+void user_disable_single_step(struct task_struct *child)
{
if (child->thread.insn1_type == 0)
write_tsk_short(child, child->thread.addr1,
@@ -230,54 +258,17 @@ void clear_single_step(struct task_struct *child)
child->thread.ss_nextcnt = 0;
}
-
-void ptrace_disable(struct task_struct *child) {}
+void ptrace_disable(struct task_struct *child)
+{
+ user_disable_single_step(child);
+}
long
arch_ptrace(struct task_struct *child, long request, long addr, long data)
{
int ret;
- if (request == PTRACE_TRACEME) {
- /* are we already being traced? */
- if (current->ptrace & PT_PTRACED)
- return -EPERM;
-
- /* set the ptrace bit in the process flags. */
- current->ptrace |= PT_PTRACED;
- return 0;
- }
-
- ret = -ESRCH;
- if (!child)
- return ret;
-
- ret = -EPERM;
-
- if (request == PTRACE_ATTACH) {
- ret = ptrace_attach(child);
- return ret;
- }
-
- ret = ptrace_check_attach(child, request == PTRACE_KILL);
- if (ret < 0)
- return ret;
-
switch (request) {
- case PTRACE_PEEKTEXT: /* read word at location addr. */
- case PTRACE_PEEKDATA: {
- unsigned long tmp;
- int copied;
-
- copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
- ret = -EIO;
- if (copied != sizeof(tmp))
- break;
-
- ret = put_user(tmp, (unsigned long *) data);
- return ret;
- }
-
/* Read the word at location addr in the USER area. */
case PTRACE_PEEKUSR: {
struct pt_regs *regs;
@@ -329,15 +320,6 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data)
return ret;
}
- case PTRACE_POKETEXT: /* write the word at location addr. */
- case PTRACE_POKEDATA:
- ret = 0;
- if (access_process_vm(child, addr, &data, sizeof(data), 1)
- == sizeof(data))
- break;
- ret = -EIO;
- return ret;
-
case PTRACE_POKEUSR: {
struct pt_regs *regs;
ret = 0;
@@ -372,64 +354,16 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data)
break;
}
- case PTRACE_SYSCALL: /* continue and stop at next
- (return from) syscall. */
- case PTRACE_CONT: { /* restart after signal. */
- ret = -EIO;
- if (!valid_signal(data))
- break;
- if (request == PTRACE_SYSCALL)
- set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- else
- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-
- child->exit_code = data;
- wake_up_process(child);
- ret = 0;
- break;
- }
-
- /*
- * make the child exit. Best I can do is send it a sigkill.
- * perhaps it should be put in the status that it wants to
- * exit.
- */
- case PTRACE_KILL:
- ret = 0;
- if (child->state == EXIT_ZOMBIE) /* already dead. */
- break;
- child->exit_code = SIGKILL;
- clear_single_step(child);
- wake_up_process(child);
+ case PTRACE_GETREGS:
+ ret = ptrace_getregs(child, (void __user *)data);
break;
- case PTRACE_SINGLESTEP: { /* set the trap flag. */
- ret = -EIO;
- if ((unsigned long) data > _NSIG)
- break;
- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- set_single_step(child);
- child->exit_code = data;
- /* give it a chance to run. */
- wake_up_process(child);
- ret = 0;
- break;
- }
-
- case PTRACE_DETACH: /* detach a process that was attached. */
- ret = ptrace_detach(child, data);
- break;
-
- case PTRACE_SETOPTIONS:
- if (data & PTRACE_O_TRACESYSGOOD)
- child->ptrace |= PT_TRACESYSGOOD;
- else
- child->ptrace &= ~PT_TRACESYSGOOD;
- ret = 0;
+ case PTRACE_SETREGS:
+ ret = ptrace_setregs(child, (void __user *)data);
break;
default:
- ret = -EIO;
+ ret = ptrace_request(child, request, addr, data);
break;
}
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c
index b4ed1b3..5c00408 100644
--- a/arch/score/kernel/signal.c
+++ b/arch/score/kernel/signal.c
@@ -132,7 +132,7 @@ void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
return (void *)((sp - frame_size) & ~7);
}
-asmlinkage int score_sigaltstack(struct pt_regs *regs)
+int score_sigaltstack(struct pt_regs *regs)
{
const stack_t *uss = (const stack_t *) regs->regs[4];
stack_t *uoss = (stack_t *) regs->regs[5];
@@ -141,7 +141,7 @@ asmlinkage int score_sigaltstack(struct pt_regs *regs)
return do_sigaltstack(uss, uoss, usp);
}
-asmlinkage void score_rt_sigreturn(struct pt_regs *regs)
+void score_rt_sigreturn(struct pt_regs *regs)
{
struct rt_sigframe __user *frame;
sigset_t set;
@@ -276,7 +276,7 @@ int handle_signal(unsigned long sig, siginfo_t *info,
return ret;
}
-asmlinkage void do_signal(struct pt_regs *regs)
+void do_signal(struct pt_regs *regs)
{
struct k_sigaction ka;
sigset_t *oldset;
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c
index 6a60d1e..68655f4 100644
--- a/arch/score/kernel/sys_score.c
+++ b/arch/score/kernel/sys_score.c
@@ -64,8 +64,7 @@ sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
* Clone a task - this clones the calling program thread.
* This is called indirectly via a small wrapper
*/
-asmlinkage int
-score_clone(struct pt_regs *regs)
+int score_clone(struct pt_regs *regs)
{
unsigned long clone_flags;
unsigned long newsp;
@@ -93,7 +92,7 @@ score_clone(struct pt_regs *regs)
* sys_execve() executes a new program.
* This is called indirectly via a small wrapper
*/
-asmlinkage int score_execve(struct pt_regs *regs)
+int score_execve(struct pt_regs *regs)
{
int error;
char *filename;
@@ -114,7 +113,7 @@ asmlinkage int score_execve(struct pt_regs *regs)
* If we ever come here the user sp is bad. Zap the process right away.
* Due to the bad stack signaling wouldn't work.
*/
-asmlinkage void bad_stack(void)
+void bad_stack(void)
{
do_exit(SIGSEGV);
}
diff --git a/arch/score/kernel/traps.c b/arch/score/kernel/traps.c
index 957ae9e..0e46fb1 100644
--- a/arch/score/kernel/traps.c
+++ b/arch/score/kernel/traps.c
@@ -252,7 +252,7 @@ asmlinkage void do_ri(struct pt_regs *regs)
if (current->thread.single_step == 1) {
if ((epc == current->thread.addr1) ||
(epc == current->thread.addr2)) {
- clear_single_step(current);
+ user_disable_single_step(current);
force_sig(SIGTRAP, current);
return;
} else
OpenPOWER on IntegriCloud