summaryrefslogtreecommitdiffstats
path: root/sys/lib/libkern/arch
diff options
context:
space:
mode:
authorgkoehler <gkoehler@openbsd.org>2020-10-27 01:26:53 +0000
committergkoehler <gkoehler@openbsd.org>2020-10-27 01:26:53 +0000
commit9df9de38a103c48c52fb9b44dcfb01d26c3d4100 (patch)
treeb502693cab6ecdeea1f0535958d64d3b258a9223 /sys/lib/libkern/arch
parentFix parsing GTP packets with invalid extended headers. (diff)
downloadwireguard-openbsd-9df9de38a103c48c52fb9b44dcfb01d26c3d4100.tar.xz
wireguard-openbsd-9df9de38a103c48c52fb9b44dcfb01d26c3d4100.zip
Retguared asm macros for powerpc libkern
This was in the macppc snap, but I forgot to include it in my last commit "Retguard asm macros for powerpc libc, ld.so"
Diffstat (limited to 'sys/lib/libkern/arch')
-rw-r--r--sys/lib/libkern/arch/powerpc/ffs.S4
-rw-r--r--sys/lib/libkern/arch/powerpc/memmove.S15
2 files changed, 12 insertions, 7 deletions
diff --git a/sys/lib/libkern/arch/powerpc/ffs.S b/sys/lib/libkern/arch/powerpc/ffs.S
index 13fe17fb4f8..5e0e64c53aa 100644
--- a/sys/lib/libkern/arch/powerpc/ffs.S
+++ b/sys/lib/libkern/arch/powerpc/ffs.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs.S,v 1.1 2020/06/10 20:19:29 naddy Exp $ */
+/* $OpenBSD: ffs.S,v 1.2 2020/10/27 01:26:53 gkoehler Exp $ */
/*
* Written by Christian Weisgerber <naddy@openbsd.org>.
* Public domain.
@@ -7,9 +7,11 @@
#include <machine/asm.h>
ENTRY(ffs)
+ RETGUARD_SETUP(ffs)
neg %r4, %r3
and %r3, %r3, %r4
cntlzw %r3, %r3
subfic %r3, %r3, 32
+ RETGUARD_CHECK(ffs)
blr
END(ffs)
diff --git a/sys/lib/libkern/arch/powerpc/memmove.S b/sys/lib/libkern/arch/powerpc/memmove.S
index cc77453a4fd..4633cd0beac 100644
--- a/sys/lib/libkern/arch/powerpc/memmove.S
+++ b/sys/lib/libkern/arch/powerpc/memmove.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: memmove.S,v 1.4 2013/06/15 20:05:41 miod Exp $ */
+/* $OpenBSD: memmove.S,v 1.5 2020/10/27 01:26:53 gkoehler Exp $ */
/* $NetBSD: memmove.S,v 1.3 2011/01/15 07:31:12 matt Exp $ */
/* stropt/memmove.S, pl_string_common, pl_linux 10/11/04 11:45:37
@@ -45,6 +45,7 @@
/* void *memcpy(void *to, const void *from, size_t len) */
ENTRY(memcpy)
+ RETGUARD_SETUP(memmove)
mr %r8, %r3 /* Save dst (return value) */
b fwd
@@ -56,6 +57,7 @@ ENTRY(bcopy)
/* void *memmove(void *, const void *, size_t) */
ENTRY(memmove)
+ RETGUARD_SETUP(memmove)
mr %r8, %r3 /* Save dst (return value) */
cmpw %r4, %r8 /* Branch to reverse if */
@@ -97,21 +99,20 @@ last:
last1: /* Byte-by-byte copy */
clrlwi. %r5,%r5,30 /* If count -> 0, then ... */
- beqlr /* we're done */
+ beq done /* we're done */
mtctr %r5 /* else load count for loop */
lbzu %r6, 4(%r4) /* 1st byte: update addr by 4 */
stbu %r6, 4(%r8) /* since we pre-adjusted by 4 */
- bdzlr- /* in anticipation of main loop */
+ bdz- done /* in anticipation of main loop */
last2:
lbzu %r6, 1(%r4) /* But handle the rest by */
stbu %r6, 1(%r8) /* updating addr by 1 */
bdnz+ last2
-
- blr
+ b done
/* We're here since src < dest. Don't want to overwrite end of */
/* src with start of dest */
@@ -154,7 +155,7 @@ rlast:
rlast1: /* Byte-by-byte copy */
clrlwi. %r5,%r5,30 /* If count -> 0, then... */
- beqlr /* ... we're done */
+ beq done /* ... we're done */
mtctr %r5 /* else load count for loop */
@@ -165,4 +166,6 @@ rlast2:
bdnz+ rlast2 /* Dec ctr, and branch if more */
/* bytes left */
+done:
+ RETGUARD_CHECK(memmove)
blr