[PATCH RFC 08/28] ARM: entry: Move trace entry to C function

From: Linus Walleij
Date: Thu Oct 10 2024 - 07:35:10 EST


This moves over the code entering into tracing into the
C syscall invocation code. As syscall_trace_enter() will
provide the current syscall number from the regs we need
not provide the syscall number to the invocation function
any more.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
arch/arm/include/asm/syscall.h | 2 +-
arch/arm/kernel/entry-common.S | 6 +-----
arch/arm/kernel/syscall.c | 5 ++++-
3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index 1d21f26ecf51..66067d165ba3 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -20,7 +20,7 @@
extern const unsigned long sys_call_table[];

int invoke_syscall(void *table, struct pt_regs *regs, int scno, void *retp);
-int invoke_syscall_trace(void *table, struct pt_regs *regs, int scno, void *retp);
+int invoke_syscall_trace(void *table, struct pt_regs *regs, void *retp);

static inline int syscall_get_nr(struct task_struct *task,
struct pt_regs *regs)
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 77801d039b5f..3cfc6d952ff9 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -292,13 +292,9 @@ ENDPROC(vector_swi)
* context switches, and waiting for our parent to respond.
*/
__sys_trace:
- add r0, sp, #S_OFF
- bl syscall_trace_enter
- mov scno, r0
- mov r2, r0 @ scno into r2
add r1, sp, #S_R0 + S_OFF @ pointer to regs
mov r0, tbl
- badr r3, __sys_trace_return
+ badr r2, __sys_trace_return
bl invoke_syscall_trace
cmp r0, #-1
bne __sys_trace_return
diff --git a/arch/arm/kernel/syscall.c b/arch/arm/kernel/syscall.c
index d1259c6d2805..815312f7b254 100644
--- a/arch/arm/kernel/syscall.c
+++ b/arch/arm/kernel/syscall.c
@@ -19,8 +19,11 @@ __visible int invoke_syscall(void *table, struct pt_regs *regs, int scno, void *

int invoke_syscall_trace_asm(void *table, struct pt_regs *regs, int scno, void *retp);

-__visible int invoke_syscall_trace(void *table, struct pt_regs *regs, int scno, void *retp)
+__visible int invoke_syscall_trace(void *table, struct pt_regs *regs, void *retp)
{
+ int scno;
+
+ scno = syscall_trace_enter(regs);
if (scno == -1)
return -1;


--
2.46.2