Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163595
b: refs/heads/master
c: f673c03
h: refs/heads/master
i:
  163593: e9da8a4
  163591: 5a84852
v: v3
  • Loading branch information
Arnd Bergmann committed Jun 19, 2009
1 parent a184ac3 commit cb26bb3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 54 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 78229db4c4f78f27ecf772fe7489a70530ba9862
refs/heads/master: f673c032ed13ed8f3fda5922c2190da2892398bc
3 changes: 2 additions & 1 deletion trunk/arch/score/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
extra-y := head.o vmlinux.lds

obj-y += entry.o init_task.o irq.o process.o ptrace.o \
setup.o signal.o sys_score.o time.o traps.o
setup.o signal.o sys_score.o time.o traps.o \
sys_call_table.o

obj-$(CONFIG_MODULES) += module.o
47 changes: 3 additions & 44 deletions trunk/arch/score/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ ENTRY(handle_sys)
sw r4, [r0, PT_ORIG_R4] #for restart syscall
sw r7, [r0, PT_ORIG_R7] #for restart syscall
sw r27, [r0, PT_IS_SYSCALL] # it from syscall
sw r8, [r0, 16] # argument 5 from user r8
sw r9, [r0, 20] # argument 6 from user r9

lw r9, [r0, PT_EPC] # skip syscall on return
addi r9, 4
Expand All @@ -408,19 +410,14 @@ ENTRY(handle_sys)
cmpi.c r27, __NR_syscalls # check syscall number
bgtu illegal_syscall

slli r8, r27, 3 # get syscall routine
slli r8, r27, 2 # get syscall routine
la r11, sys_call_table
add r11, r11, r8
lw r10, [r11] # get syscall entry
lw r11, [r11, 4] # get number of args

cmpz.c r10
beq illegal_syscall

cmpi.c r11, 4 # more than 4 arguments?
bgtu stackargs

stack_done:
lw r8, [r28, TI_FLAGS]
li r9, _TIF_SYSCALL_TRACE
and.c r8, r8, r9
Expand Down Expand Up @@ -475,44 +472,6 @@ syscall_trace_entry:
1: sw r4, [r0, PT_R2] # result
j syscall_exit

stackargs:
lw r8, [r0, PT_R0]
andri.c r9, r8, 3 # test whether user sp is align a word
bne bad_stack
subi r11, 5
slli r9, r11, 2
add.c r9, r9, r8

bmi bad_stack
la r9, 3f # calculate branch address
slli r11, r11, 3
sub r9, r9, r11
br r9

2: lw r9, [r8, 20] # argument 6 from usp
sw r9, [r0, 20]

3: lw r9, [r8, 16] # argument 5 from usp
sw r9, [r0, 16]
j stack_done

.section __ex_table,"a"
.word 2b, bad_stack
.word 3b, bad_stack
.previous

/*
* The stackpointer for a call with more than 4 arguments is bad.
* We probably should handle this case a bit more drastic.
*/
bad_stack:
neg r27, r27 # error
sw r27, [r0, PT_ORIG_R4]
sw r27, [r0, PT_R4]
ldi r8, 1 # set error flag
sw r8, [r0, PT_R7]
j syscall_return

illegal_syscall:
ldi r4, -ENOSYS # error
sw r4, [r0, PT_ORIG_R4]
Expand Down
12 changes: 12 additions & 0 deletions trunk/arch/score/kernel/sys_call_table.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <linux/syscalls.h>
#include <linux/signal.h>
#include <linux/unistd.h>

#include <asm/syscalls.h>

#undef __SYSCALL
#define __SYSCALL(nr, call) [nr] = (call),

void *sys_call_table[__NR_syscalls] = {
#include <asm/unistd.h>
};
9 changes: 1 addition & 8 deletions trunk/arch/score/kernel/sys_score.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,7 @@ int score_clone(struct pt_regs *regs)
if (!newsp)
newsp = regs->regs[0];
parent_tidptr = (int __user *)regs->regs[6];

child_tidptr = NULL;
if (clone_flags & (CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)) {
int __user *__user *usp = (int __user *__user *)regs->regs[0];

if (get_user(child_tidptr, &usp[4]))
return -EFAULT;
}
child_tidptr = (int __user *)regs->regs[8];

return do_fork(clone_flags, newsp, regs, 0,
parent_tidptr, child_tidptr);
Expand Down

0 comments on commit cb26bb3

Please sign in to comment.