summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorHuacai Chen <chenhuacai@loongson.cn>2023-02-25 10:52:57 +0300
committerHuacai Chen <chenhuacai@loongson.cn>2023-02-25 17:12:18 +0300
commiteb4071b988397144a35c4aa98061f587cbb3b467 (patch)
treeae37591bc43fbc34e3d98d54365c443f29d91f3d /tools/testing
parent121ff07bdee06555835e26499f5c125223a6beb3 (diff)
downloadlinux-eb4071b988397144a35c4aa98061f587cbb3b467.tar.xz
selftests/seccomp: Add LoongArch selftesting support
BPF for LoongArch is supported now, add the selftesting support in seccomp_bpf.c. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/seccomp/seccomp_bpf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 9c2f448bb3a9..3933f34b6b05 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -128,6 +128,8 @@ struct seccomp_data {
# define __NR_seccomp 277
# elif defined(__csky__)
# define __NR_seccomp 277
+# elif defined(__loongarch__)
+# define __NR_seccomp 277
# elif defined(__hppa__)
# define __NR_seccomp 338
# elif defined(__powerpc__)
@@ -1753,6 +1755,10 @@ TEST_F(TRACE_poke, getpid_runs_normally)
NT_ARM_SYSTEM_CALL, &__v)); \
} while (0)
# define SYSCALL_RET(_regs) (_regs).regs[0]
+#elif defined(__loongarch__)
+# define ARCH_REGS struct user_pt_regs
+# define SYSCALL_NUM(_regs) (_regs).regs[11]
+# define SYSCALL_RET(_regs) (_regs).regs[4]
#elif defined(__riscv) && __riscv_xlen == 64
# define ARCH_REGS struct user_regs_struct
# define SYSCALL_NUM(_regs) (_regs).a7