From: kemal <[email protected]>

Support aarch64 to test "Syscall User Dispatch" feature with
sud_test selftest testcase.

On qemu-kvm machine, the sud_benchmark test results are as below:

        # ./sud_benchmark
        Calibrating test set to last ~5 seconds...
        test iterations = 24500000
        Avg syscall time 208ns.
        Enabling syscall trapping.
        Caught sys_1c2
        trapped_call_count 1, native_call_count 0.
        Avg syscall time 213ns.
        Interception overhead: 2.5% (+5ns).

Reviewed-by: Yeoreum Yun <[email protected]>
Signed-off-by: kemal <[email protected]>
Signed-off-by: Jinjie Ruan <[email protected]>
---
 tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c | 2 +-
 tools/testing/selftests/syscall_user_dispatch/sud_test.c      | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c 
b/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
index 073a03702ff5..6059abe75cb3 100644
--- a/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
+++ b/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
@@ -41,7 +41,7 @@
  * out of the box, but don't enable them until they support syscall user
  * dispatch.
  */
-#if defined(__x86_64__) || defined(__i386__)
+#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
 #define TEST_BLOCKED_RETURN
 #endif
 
diff --git a/tools/testing/selftests/syscall_user_dispatch/sud_test.c 
b/tools/testing/selftests/syscall_user_dispatch/sud_test.c
index b855c6000287..3ffea2f4a66d 100644
--- a/tools/testing/selftests/syscall_user_dispatch/sud_test.c
+++ b/tools/testing/selftests/syscall_user_dispatch/sud_test.c
@@ -192,6 +192,10 @@ static void handle_sigsys(int sig, siginfo_t *info, void 
*ucontext)
        ((ucontext_t *)ucontext)->uc_mcontext.__gregs[REG_A0] =
                        ((ucontext_t *)ucontext)->uc_mcontext.__gregs[REG_A7];
 #endif
+#ifdef __aarch64__
+       ((ucontext_t *)ucontext)->uc_mcontext.regs[0] = (unsigned int)
+                       ((ucontext_t *)ucontext)->uc_mcontext.regs[8];
+#endif
 }
 
 int setup_sigsys_handler(void)
-- 
2.34.1


Reply via email to