summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc64
diff options
context:
space:
mode:
authormortimer <mortimer@cvs.openbsd.org>2020-10-21 23:53:23 +0000
committermortimer <mortimer@cvs.openbsd.org>2020-10-21 23:53:23 +0000
commita293991d7fc62cfbd091cc4ae0882e83fc422c08 (patch)
tree4f4d568314166914437692bfca60aa601193e577 /sys/arch/powerpc64
parentaa7b3961679f09590d8e4c55db2330ee98ba4bcd (diff)
Add retguard macros to powerpc64 locore functions.
ok deraadt@ kettenis@
Diffstat (limited to 'sys/arch/powerpc64')
-rw-r--r--sys/arch/powerpc64/powerpc64/locore.S20
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/arch/powerpc64/powerpc64/locore.S b/sys/arch/powerpc64/powerpc64/locore.S
index d9aa3e82c83..1ca5aa2c969 100644
--- a/sys/arch/powerpc64/powerpc64/locore.S
+++ b/sys/arch/powerpc64/powerpc64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.39 2020/10/10 13:19:50 kettenis Exp $ */
+/* $OpenBSD: locore.S,v 1.40 2020/10/21 23:53:22 mortimer Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -24,6 +24,7 @@
#include <machine/param.h>
#include <machine/opal.h>
#include <machine/psl.h>
+#include <machine/asm.h>
.abiversion 2
@@ -145,6 +146,9 @@ cpu_switchto_asm:
addi %r31, %r31, PCB_SP
#endif
stdcx. %r1, 0, %r31 /* clear a possible reservation */
+ ld %r0, (SFRAMELEN + 16)(%r1)
+ mtlr %r0
+ RETGUARD_SETUP(cpu_switchto_asm, %r11)
ld %r31, P_MD_USER_SLB_PA(%r4)
std %r31, CI_USER_SLB_PA(%r30)
@@ -170,12 +174,12 @@ cpu_switchto_asm:
ld %r10, SF_CR(%r1)
addi %r1, %r1, SFRAMELEN
mtcr %r10
- ld %r0, 16(%r1)
- mtlr %r0
+ RETGUARD_CHECK(cpu_switchto_asm, %r11)
blr
.globl kcopy
kcopy:
+ RETGUARD_SETUP(kcopy, %r11)
mfsprg0 %r7
ld %r7, CI_CURPCB(%r7)
ld %r8, PCB_ONFAULT(%r7)
@@ -222,15 +226,18 @@ kcopy:
.Lkcopysuccess:
std %r8, PCB_ONFAULT(%r7)
li %r3, 0
+.Lkcopydone:
+ RETGUARD_CHECK(kcopy, %r11)
blr
.Lkcopyfault:
std %r8, PCB_ONFAULT(%r7)
li %r3, EFAULT
- blr
+ b .Lkcopydone
.globl copystr
copystr:
+ RETGUARD_SETUP(copystr, %r11)
mfsprg0 %r7
ld %r7, CI_CURPCB(%r7)
ld %r8, PCB_ONFAULT(%r7)
@@ -270,6 +277,7 @@ copystr:
std %r9, 0(%r6)
2:
std %r8, PCB_ONFAULT(%r7)
+ RETGUARD_CHECK(copystr, %r11)
blr
.globl proc_trampoline
@@ -397,6 +405,7 @@ db_enter:
.globl setjmp
setjmp:
+ RETGUARD_SETUP(setjmp, %r11)
mflr %r0
mfcr %r5
std %r0, 0x00(%r3) /* lr */
@@ -422,6 +431,7 @@ setjmp:
std %r30, 0xa0(%r3)
std %r31, 0xa8(%r3)
li %r3, 0 /* return 0 */
+ RETGUARD_CHECK(setjmp, %r11)
blr
.globl longjmp
@@ -429,6 +439,7 @@ longjmp:
ld %r0, 0x00(%r3) /* lr */
ld %r5, 0x08(%r3) /* cr */
mtlr %r0
+ RETGUARD_SETUP(longjmp, %r11)
mtcr %r5
ld %r1, 0x10(%r3)
ld %r2, 0x18(%r3)
@@ -451,5 +462,6 @@ longjmp:
ld %r30, 0xa0(%r3)
ld %r31, 0xa8(%r3)
mr %r4, %r3 /* return val */
+ RETGUARD_CHECK(longjmp, %r11)
blr
#endif