Commit 5576c776 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Implement force_successful_syscall().

parent 4be5bd85
......@@ -1749,8 +1749,8 @@ ret_sys_call:
cmp %o0, -ENOIOCTLCMD
sllx %g2, 32, %g2
bgeu,pn %xcc, 1f
andcc %l0, _TIF_SYSCALL_TRACE, %l6
80:
andn %g3, %g2, %g3 /* System call success, clear Carry condition code. */
stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
bne,pn %icc, linux_syscall_trace2
......@@ -1760,9 +1760,21 @@ ret_sys_call:
stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1:
/* Really a failure? Check if force_successful_syscall_return()
* was invoked.
*/
ldx [%curptr + TI_FLAGS], %l0 ! Load
andcc %l0, _TIF_SYSCALL_SUCCESS, %g0
be,pt %icc, 1f
andcc %l0, _TIF_SYSCALL_TRACE, %l6
andn %l0, _TIF_SYSCALL_SUCCESS, %l0
ba,pt %xcc, 80b
stx %l0, [%curptr + TI_FLAGS]
/* System call failure, set Carry condition code.
* Also, get abs(errno) to return to the process.
*/
1:
sub %g0, %o0, %o0
or %g3, %g2, %g3
stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
......
......@@ -94,6 +94,8 @@ struct sparc_trapf {
#define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
#ifdef __KERNEL__
#define force_successful_syscall_return() \
set_thread_flag(TIF_SYSCALL_SUCCESS)
#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
#define instruction_pointer(regs) ((regs)->tpc)
extern void show_regs(struct pt_regs *);
......
......@@ -205,7 +205,12 @@ register struct thread_info *current_thread_info_reg asm("g6");
#define TIF_BLKCOMMIT 9 /* use ASI_BLK_COMMIT_* in copy_user_page */
#define TIF_POLLING_NRFLAG 10
#define TIF_ABI_PENDING 11
#define TIF_SYSCALL_SUCCESS 11
/* NOTE: Thread flags >= 12 should be ones we have no interest
* in using in assembly, else we can't use the mask as
* an immediate value in instructions such as andcc.
*/
#define TIF_ABI_PENDING 12
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
......@@ -219,6 +224,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
#define _TIF_BLKCOMMIT (1<<TIF_BLKCOMMIT)
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
#define _TIF_SYSCALL_SUCCESS (1<<TIF_SYSCALL_SUCCESS)
#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
(_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
......
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