summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2022-03-22 06:51:13 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2022-03-22 06:51:13 +0000
commitf2489cedc7f323b439908ee68dbdc5f5a457ac6e (patch)
treec45b2b80fdfc2390b745703d1314ded795563b59 /sys/arch
parent473e5babac5bc50834fd40d5a490727febc8e2bd (diff)
Make sure kernel longjmp always returns 1 rather than what turns out to be
in a register at call-time. with & ok jsg@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc64/powerpc64/locore.S4
-rw-r--r--sys/arch/riscv64/riscv64/support.S8
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/arch/powerpc64/powerpc64/locore.S b/sys/arch/powerpc64/powerpc64/locore.S
index 10a5cd16707..46143723ca7 100644
--- a/sys/arch/powerpc64/powerpc64/locore.S
+++ b/sys/arch/powerpc64/powerpc64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.43 2021/01/23 12:10:08 kettenis Exp $ */
+/* $OpenBSD: locore.S,v 1.44 2022/03/22 06:51:12 miod Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -562,7 +562,7 @@ longjmp:
ld %r29, 0x98(%r3)
ld %r30, 0xa0(%r3)
ld %r31, 0xa8(%r3)
- mr %r4, %r3 /* return val */
+ li %r3, 1 /* return non-zero */
RETGUARD_CHECK(longjmp, %r11)
blr
#endif
diff --git a/sys/arch/riscv64/riscv64/support.S b/sys/arch/riscv64/riscv64/support.S
index 549c5e3f435..653a6b75622 100644
--- a/sys/arch/riscv64/riscv64/support.S
+++ b/sys/arch/riscv64/riscv64/support.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: support.S,v 1.2 2021/05/12 01:20:52 jsg Exp $ */
+/* $OpenBSD: support.S,v 1.3 2022/03/22 06:51:12 miod Exp $ */
/*-
* Copyright (c) 2015-2020 Ruslan Bukin <br@bsdpad.com>
@@ -58,7 +58,7 @@ ENTRY(setjmp)
sd s11, (11 * 8)(a0)
sd ra, (12 * 8)(a0)
- /* Return value */
+ /* Return zero */
li a0, 0
ret
END(setjmp)
@@ -83,7 +83,7 @@ ENTRY(longjmp)
ld s11, (11 * 8)(a0)
ld ra, (12 * 8)(a0)
- /* Load the return value */
- mv a0, a1
+ /* Return nonzero */
+ li a0, 1
ret
END(longjmp)