]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
xtensa: expose syscall through user_pt_regs
authorMax Filippov <jcmvbkbc@gmail.com>
Sun, 19 Jul 2020 00:47:43 +0000 (17:47 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 28 Jul 2020 07:57:05 +0000 (00:57 -0700)
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 <jcmvbkbc@gmail.com>
arch/xtensa/include/uapi/asm/ptrace.h
arch/xtensa/kernel/ptrace.c

index 2ec0f9100a069a3bfc9628b89717f09963bd7ca4..50db3e0a634130806fbaaba36366e150c8c09203 100644 (file)
@@ -50,7 +50,8 @@ struct user_pt_regs {
        __u32 windowstart;
        __u32 windowbase;
        __u32 threadptr;
-       __u32 reserved[7 + 48];
+       __u32 syscall;
+       __u32 reserved[6 + 48];
        __u32 a[64];
 };
 
index 0278d7dfb4d6f4f0b02bd37dfc3f47df9a73ccd0..437b4297948d1fd71e4d21c04aa205c9c11223ef 100644 (file)
@@ -52,6 +52,7 @@ static int gpr_get(struct task_struct *target,
                .threadptr = regs->threadptr,
                .windowbase = regs->windowbase,
                .windowstart = regs->windowstart,
+               .syscall = regs->syscall,
        };
 
        memcpy(newregs.a,
@@ -91,6 +92,9 @@ static int gpr_set(struct task_struct *target,
        regs->sar = newregs.sar;
        regs->threadptr = newregs.threadptr;
 
+       if (newregs.syscall)
+               regs->syscall = newregs.syscall;
+
        if (newregs.windowbase != regs->windowbase ||
            newregs.windowstart != regs->windowstart) {
                u32 rotws, wmask;