Skip to content

Commit 7fdb80e

Browse files
committed
add arm support for orig_ax->x0 register
1 parent d104df2 commit 7fdb80e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

next/src/xcapture.bpf.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@ int get_tasks(struct bpf_iter__task *ctx)
194194
// Read syscall nr and arguments from registers saved when invoking the syscall
195195
// on x86_64 ABI the args are stored in: rdi, rsi, rdx, r10, r8, r9
196196
if(regs) {
197-
t->syscall_nr = (__s32) BPF_CORE_READ(regs, orig_ax); // orig_ax holds syscall number (TODO: change for ARM64)
197+
#ifdef __x86_64__
198+
t->syscall_nr = (__s32) BPF_CORE_READ(regs, orig_ax);
199+
#else // aarch64 for now
200+
t->syscall_nr = (__s32) BPF_CORE_READ(regs, orig_x0);
201+
#endif
198202
t->syscall_args[0] = PT_REGS_PARM1_CORE_SYSCALL(regs);
199203
t->syscall_args[1] = PT_REGS_PARM2_CORE_SYSCALL(regs);
200204
t->syscall_args[2] = PT_REGS_PARM3_CORE_SYSCALL(regs);

0 commit comments

Comments
 (0)