summaryrefslogtreecommitdiff
path: root/regress/sys/kern/syscall_segment/gadgetsyscall.h
diff options
context:
space:
mode:
Diffstat (limited to 'regress/sys/kern/syscall_segment/gadgetsyscall.h')
-rw-r--r--regress/sys/kern/syscall_segment/gadgetsyscall.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/regress/sys/kern/syscall_segment/gadgetsyscall.h b/regress/sys/kern/syscall_segment/gadgetsyscall.h
index a683faf52b8..658b50b61f4 100644
--- a/regress/sys/kern/syscall_segment/gadgetsyscall.h
+++ b/regress/sys/kern/syscall_segment/gadgetsyscall.h
@@ -1,8 +1,10 @@
-/* $OpenBSD: gadgetsyscall.h,v 1.1 2019/11/27 17:15:36 mortimer Exp $ */
+/* $OpenBSD: gadgetsyscall.h,v 1.2 2020/10/20 14:40:00 kettenis Exp $ */
pid_t gadget_getpid() {
pid_t ans = 0;
-#if defined(__amd64__)
+#if defined(__aarch64__)
+ asm("ldr x8, #0x14; svc 0; dsb nsh; isb; mov %w0, w0" : "=r"(ans) :: "x0", "x8");
+#elif defined(__amd64__)
asm("mov $0x14, %%eax; syscall; mov %%eax, %0;" :"=r"(ans)::"%eax", "%ecx", "%r11");
#endif
return ans;