Skip to content

Commit 8b7a87a

Browse files
committed
xtensa: expose syscall through user_pt_regs
Use one of the reserved slots in struct user_pt_regs to return syscall number in the GPR regset. Update syscall number from the GPR regset only when it's non-zero. Signed-off-by: Max Filippov <[email protected]>
1 parent ef1a935 commit 8b7a87a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

arch/xtensa/include/uapi/asm/ptrace.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ struct user_pt_regs {
5050
__u32 windowstart;
5151
__u32 windowbase;
5252
__u32 threadptr;
53-
__u32 reserved[7 + 48];
53+
__u32 syscall;
54+
__u32 reserved[6 + 48];
5455
__u32 a[64];
5556
};
5657

arch/xtensa/kernel/ptrace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static int gpr_get(struct task_struct *target,
5252
.threadptr = regs->threadptr,
5353
.windowbase = regs->windowbase,
5454
.windowstart = regs->windowstart,
55+
.syscall = regs->syscall,
5556
};
5657

5758
memcpy(newregs.a,
@@ -91,6 +92,9 @@ static int gpr_set(struct task_struct *target,
9192
regs->sar = newregs.sar;
9293
regs->threadptr = newregs.threadptr;
9394

95+
if (newregs.syscall)
96+
regs->syscall = newregs.syscall;
97+
9498
if (newregs.windowbase != regs->windowbase ||
9599
newregs.windowstart != regs->windowstart) {
96100
u32 rotws, wmask;

0 commit comments

Comments
 (0)