Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295310
b: refs/heads/master
c: 6cbe5e9
h: refs/heads/master
v: v3
  • Loading branch information
Jonas Bonn committed Mar 6, 2012
1 parent dcd6804 commit 3817acd
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 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: 2f099a280e92c259598d8ed8da82c7ec2dd49845
refs/heads/master: 6cbe5e95267449ea0b79c0b049342409949da3ac
6 changes: 5 additions & 1 deletion trunk/arch/openrisc/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ struct pt_regs {
};
};
long pc;
/* For restarting system calls:
* Set to syscall number for syscall exceptions,
* -1 for all other exceptions.
*/
long orig_gpr11; /* For restarting system calls */
long syscallno; /* Syscall number (used by strace) */
long dummy; /* Cheap alignment fix */
long dummy2; /* Cheap alignment fix */
};

/* TODO: Rename this to REDZONE because that's what it is */
Expand Down
7 changes: 2 additions & 5 deletions trunk/arch/openrisc/include/asm/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
static inline int
syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
{
return regs->syscallno ? regs->syscallno : -1;
return regs->orig_gpr11;
}

static inline void
Expand All @@ -50,10 +50,7 @@ static inline void
syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
int error, long val)
{
if (error)
regs->gpr[11] = -error;
else
regs->gpr[11] = val;
regs->gpr[11] = (long) error ?: val;
}

static inline void
Expand Down
16 changes: 8 additions & 8 deletions trunk/arch/openrisc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ handler: ;\
/* r1, EPCR, ESR a already saved */ ;\
l.sw PT_GPR2(r1),r2 ;\
l.sw PT_GPR3(r1),r3 ;\
l.sw PT_ORIG_GPR11(r1),r11 ;\
/* r4 already save */ ;\
l.sw PT_GPR5(r1),r5 ;\
l.sw PT_GPR6(r1),r6 ;\
Expand Down Expand Up @@ -125,15 +124,16 @@ handler: ;\
/* r30 already save */ ;\
/* l.sw PT_GPR30(r1),r30*/ ;\
l.sw PT_GPR31(r1),r31 ;\
l.sw PT_SYSCALLNO(r1),r0
/* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\
l.addi r30,r0,-1 ;\
l.sw PT_ORIG_GPR11(r1),r30

#define UNHANDLED_EXCEPTION(handler,vector) \
.global handler ;\
handler: ;\
/* r1, EPCR, ESR already saved */ ;\
l.sw PT_GPR2(r1),r2 ;\
l.sw PT_GPR3(r1),r3 ;\
l.sw PT_ORIG_GPR11(r1),r11 ;\
l.sw PT_GPR5(r1),r5 ;\
l.sw PT_GPR6(r1),r6 ;\
l.sw PT_GPR7(r1),r7 ;\
Expand Down Expand Up @@ -162,7 +162,9 @@ handler: ;\
/* r31 already saved */ ;\
l.sw PT_GPR30(r1),r30 ;\
/* l.sw PT_GPR31(r1),r31 */ ;\
l.sw PT_SYSCALLNO(r1),r0 ;\
/* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\
l.addi r30,r0,-1 ;\
l.sw PT_ORIG_GPR11(r1),r30 ;\
l.addi r3,r1,0 ;\
/* r4 is exception EA */ ;\
l.addi r5,r0,vector ;\
Expand Down Expand Up @@ -554,6 +556,7 @@ ENTRY(_sys_call_handler)
l.sw PT_GPR9(r1),r9
/* r10 already saved */
l.sw PT_GPR11(r1),r11
/* orig_gpr11 must be set for syscalls */
l.sw PT_ORIG_GPR11(r1),r11
/* r12,r13 already saved */

Expand All @@ -567,9 +570,6 @@ ENTRY(_sys_call_handler)
/* r30 is the only register we clobber in the fast path */
/* r30 already saved */
/* l.sw PT_GPR30(r1),r30 */
/* This is used by do_signal to determine whether to check for
* syscall restart or not */
l.sw PT_SYSCALLNO(r1),r11

_syscall_check_trace_enter:
/* If TIF_SYSCALL_TRACE is set, then we want to do syscall tracing */
Expand Down Expand Up @@ -731,7 +731,7 @@ _syscall_trace_enter:
* so that we can do the syscall for real and return to the syscall
* hot path.
*/
l.lwz r11,PT_SYSCALLNO(r1)
l.lwz r11,PT_GPR11(r1)
l.lwz r3,PT_GPR3(r1)
l.lwz r4,PT_GPR4(r1)
l.lwz r5,PT_GPR5(r1)
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/openrisc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
*/
ret = -1L;

audit_syscall_entry(audit_arch(), regs->syscallno,
audit_syscall_entry(audit_arch(), regs->gpr[11],
regs->gpr[3], regs->gpr[4],
regs->gpr[5], regs->gpr[6]);

return ret ? : regs->syscallno;
return ret ? : regs->gpr[11];
}

asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/openrisc/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void do_signal(struct pt_regs *regs)
* below mean that the syscall executed to completion and no
* restart is necessary.
*/
if (regs->syscallno) {
if (regs->orig_gpr11) {
int restart = 0;

switch (regs->gpr[11]) {
Expand Down
8 changes: 4 additions & 4 deletions trunk/arch/openrisc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ void show_registers(struct pt_regs *regs)
regs->gpr[24], regs->gpr[25], regs->gpr[26], regs->gpr[27]);
printk("GPR28: %08lx GPR29: %08lx GPR30: %08lx GPR31: %08lx\n",
regs->gpr[28], regs->gpr[29], regs->gpr[30], regs->gpr[31]);
printk(" RES: %08lx oGPR11: %08lx syscallno: %08lx\n",
regs->gpr[11], regs->orig_gpr11, regs->syscallno);
printk(" RES: %08lx oGPR11: %08lx\n",
regs->gpr[11], regs->orig_gpr11);

printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, (unsigned long)current);
Expand Down Expand Up @@ -208,8 +208,8 @@ void nommu_dump_state(struct pt_regs *regs,
regs->gpr[24], regs->gpr[25], regs->gpr[26], regs->gpr[27]);
printk("GPR28: %08lx GPR29: %08lx GPR30: %08lx GPR31: %08lx\n",
regs->gpr[28], regs->gpr[29], regs->gpr[30], regs->gpr[31]);
printk(" RES: %08lx oGPR11: %08lx syscallno: %08lx\n",
regs->gpr[11], regs->orig_gpr11, regs->syscallno);
printk(" RES: %08lx oGPR11: %08lx\n",
regs->gpr[11], regs->orig_gpr11);

printk("Process %s (pid: %d, stackpage=%08lx)\n",
((struct task_struct *)(__pa(current)))->comm,
Expand Down

0 comments on commit 3817acd

Please sign in to comment.