From: deraadt Date: Sun, 16 May 2021 03:23:48 +0000 (+0000) Subject: add riscv asm for these two security-feature checking regress tests X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9206c8269333ee0e4fc37fcbc3a20efb5c3a8677;p=openbsd add riscv asm for these two security-feature checking regress tests with drahn --- diff --git a/regress/sys/kern/noexec/Makefile b/regress/sys/kern/noexec/Makefile index 96103c332eb..f2717bba257 100644 --- a/regress/sys/kern/noexec/Makefile +++ b/regress/sys/kern/noexec/Makefile @@ -1,4 +1,4 @@ -# $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 @@ -69,6 +69,7 @@ nxmmap-mprotect: ${PROG} ${MACHINE} != "i386" && \ ${MACHINE} != "octeon" && \ ${MACHINE} != "powerpc64" && \ + ${MACHINE} != "riscv64" && \ ${MACHINE} != "sparc64" REGRESS_TARGETS=run-regress-skiparch run-regress-skiparch: diff --git a/regress/sys/kern/noexec/testfly.S b/regress/sys/kern/noexec/testfly.S index 46faa42d936..3fabe27cdf4 100644 --- a/regress/sys/kern/noexec/testfly.S +++ b/regress/sys/kern/noexec/testfly.S @@ -1,4 +1,4 @@ -/* $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 @@ -65,6 +65,12 @@ LEAF(testfly, 0) END(testfly) #endif +#ifdef __riscv64 +ENTRY(testfly) + jr ra +END(testfly) +#endif + #ifdef __powerpc__ ENTRY(testfly) blr diff --git a/regress/sys/kern/stackpivot/Makefile b/regress/sys/kern/stackpivot/Makefile index a9f963de3a0..fa6f2450e75 100644 --- a/regress/sys/kern/stackpivot/Makefile +++ b/regress/sys/kern/stackpivot/Makefile @@ -3,6 +3,7 @@ ${MACHINE} != "amd64" && \ ${MACHINE} != "i386" && \ ${MACHINE} != "powerpc64" && \ + ${MACHINE} != "riscv64" && \ ${MACHINE_ARCH} != "powerpc" && \ ${MACHINE_ARCH} != "mips64" && \ ${MACHINE_ARCH} != "mips64el" diff --git a/regress/sys/kern/stackpivot/pivot.h b/regress/sys/kern/stackpivot/pivot.h index eec535278ee..fe87baab431 100644 --- a/regress/sys/kern/stackpivot/pivot.h +++ b/regress/sys/kern/stackpivot/pivot.h @@ -14,6 +14,8 @@ static void pivot(void *newstack) { 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 }