summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-10-20 14:40:01 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-10-20 14:40:01 +0000
commit60f8a474b73f9320deccdaf965b4dfd774274481 (patch)
tree9870f262efe057f5c340e47a4ee7ad9ac77206f1
parent5beaf447186df4b8c23662fbf9adb8236f6958f3 (diff)
Add arm64 support.
ok deraadt@
-rw-r--r--regress/sys/kern/syscall_segment/Makefile.inc4
-rw-r--r--regress/sys/kern/syscall_segment/gadgetsyscall.h6
2 files changed, 6 insertions, 4 deletions
diff --git a/regress/sys/kern/syscall_segment/Makefile.inc b/regress/sys/kern/syscall_segment/Makefile.inc
index 79a317b8238..8d1d1d70deb 100644
--- a/regress/sys/kern/syscall_segment/Makefile.inc
+++ b/regress/sys/kern/syscall_segment/Makefile.inc
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile.inc,v 1.1 2020/10/16 21:34:59 bluhm Exp $
+# $OpenBSD: Makefile.inc,v 1.2 2020/10/20 14:40:00 kettenis Exp $
-.if ${MACHINE} != "amd64"
+.if ${MACHINE} != "amd64" && ${MACHINE} != "arm64"
regress:
# Need syscall asm for this arch
@echo SKIPPED
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;