-# $OpenBSD: Makefile,v 1.22 2020/12/17 00:51:12 bluhm Exp $
+# $OpenBSD: Makefile,v 1.23 2021/05/16 03:23:48 deraadt Exp $
PROG= noexec
SRCS= noexec.c testfly.S
${MACHINE} != "i386" && \
${MACHINE} != "octeon" && \
${MACHINE} != "powerpc64" && \
+ ${MACHINE} != "riscv64" && \
${MACHINE} != "sparc64"
REGRESS_TARGETS=run-regress-skiparch
run-regress-skiparch:
-/* $OpenBSD: testfly.S,v 1.8 2020/07/06 07:31:19 kettenis Exp $ */
+/* $OpenBSD: testfly.S,v 1.9 2021/05/16 03:23:48 deraadt Exp $ */
/*
* Copyright (c) 2002,2003 Michael Shalayeff
END(testfly)
#endif
+#ifdef __riscv64
+ENTRY(testfly)
+ jr ra
+END(testfly)
+#endif
+
#ifdef __powerpc__
ENTRY(testfly)
blr
${MACHINE} != "amd64" && \
${MACHINE} != "i386" && \
${MACHINE} != "powerpc64" && \
+ ${MACHINE} != "riscv64" && \
${MACHINE_ARCH} != "powerpc" && \
${MACHINE_ARCH} != "mips64" && \
${MACHINE_ARCH} != "mips64el"
asm("mr %%r1, %0; ld %%r3, 0(%%r1); mtlr %%r3; blr;" ::"r"(newstack));
#elif defined(__powerpc__)
asm("mr %%r1, %0; lwz %%r3, 0(%%r1); mtlr %%r3; blr;" ::"r"(newstack));
+#elif defined(__riscv)
+ asm("mv sp, %0; ld ra, 0(sp); jr ra" ::"r"(newstack));
#endif
}