diff options
author | 2020-10-18 17:51:39 +0000 | |
---|---|---|
committer | 2020-10-18 17:51:39 +0000 | |
commit | edea1d570b318ab2919942f3d44635aad673b7a3 (patch) | |
tree | c7e0ed2c7630e5e6e4cffadf089043c8fd32d9d3 /lib/libc | |
parent | XFAIL tests on arm64 and armv7 as floating-point exception support is (diff) | |
download | wireguard-openbsd-edea1d570b318ab2919942f3d44635aad673b7a3.tar.xz wireguard-openbsd-edea1d570b318ab2919942f3d44635aad673b7a3.zip |
Add powerpc64 retguard macros for setjmp / longjmp.
ok deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/arch/powerpc64/gen/setjmp.S | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/libc/arch/powerpc64/gen/setjmp.S b/lib/libc/arch/powerpc64/gen/setjmp.S index 170aa9ec4b4..0d099f506d3 100644 --- a/lib/libc/arch/powerpc64/gen/setjmp.S +++ b/lib/libc/arch/powerpc64/gen/setjmp.S @@ -1,4 +1,4 @@ -/* $OpenBSD: setjmp.S,v 1.3 2020/07/02 08:59:45 kettenis Exp $ */ +/* $OpenBSD: setjmp.S,v 1.4 2020/10/18 17:51:39 mortimer Exp $ */ /* * Copyright (c) 2020 Dale Rahn. All rights reserved. * @@ -78,6 +78,7 @@ ENTRY(setjmp) ENTRY(_setjmp) mr %r5, %r3 /* save jmpbuf addr in r5 */ 1: + RETGUARD_SETUP(setjmp, %r11) addis %r7, %r2, __jmpxor@toc@ha addi %r7, %r7, __jmpxor@toc@l ld %r0, 0(%r7) /* xor for r1 */ @@ -116,6 +117,7 @@ ENTRY(_setjmp) std %r0, JMP_xer(%r5) /* floating point is all caller save */ li %r3, 0 + RETGUARD_CHECK(setjmp, %r11) blr END(_setjmp) END(setjmp) @@ -143,6 +145,10 @@ ENTRY(_longjmp) addi %r9, %r9, __jmpxor@toc@l ld %r8, 0(%r9) /* xor for r1 */ ld %r9, 8(%r9) /* xor for lr, overwrite addr */ + ld %r0, JMP_lr(%r5) + xor %r0, %r0, %r9 /* use the lr xor */ + mtlr %r0 + RETGUARD_SETUP(longjmp, %r11) /* r1, r14-r31 */ ld %r0, JMP_r1(%r5) @@ -168,9 +174,6 @@ ENTRY(_longjmp) /* cr, lr, ctr, xer */ ld %r8, JMP_cr(%r5) /* overwrite the r1 xor */ mtcr %r8 - ld %r0, JMP_lr(%r5) - xor %r0, %r0, %r9 /* use the lr xor */ - mtlr %r0 ld %r9, JMP_ctr(%r5) /* overwrite the lr xor */ mtctr %r9 ld %r0, JMP_xer(%r5) @@ -180,8 +183,10 @@ ENTRY(_longjmp) /* if return val in r6 == 0, return 1, not 0 */ mr %r3, %r6 cmpwi %r6, 0 - bnelr + bne 2f li %r3, 1 +2: + RETGUARD_CHECK(longjmp, %r11) blr END(_longjmp) END(longjmp) |