summaryrefslogtreecommitdiff
path: root/lib/libc/arch
diff options
context:
space:
mode:
authorgkoehler <gkoehler@cvs.openbsd.org>2020-07-27 05:08:58 +0000
committergkoehler <gkoehler@cvs.openbsd.org>2020-07-27 05:08:58 +0000
commit9212e01b6d2268752aa9967e695397d330f58cff (patch)
treec35520b54deb18f235dd506e8ae64c87fd94e816 /lib/libc/arch
parentb146a3f4ae94f393e8f6e60b013d60575a815496 (diff)
Fix powerpc64's sbrk()
Initialize __curbrk = &_end. It's a 64-bit pointer, so use ld/std instead of lwz/stw. ok drahn@
Diffstat (limited to 'lib/libc/arch')
-rw-r--r--lib/libc/arch/powerpc64/sys/sbrk.S8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/arch/powerpc64/sys/sbrk.S b/lib/libc/arch/powerpc64/sys/sbrk.S
index c08cb67c591..9d738f44749 100644
--- a/lib/libc/arch/powerpc64/sys/sbrk.S
+++ b/lib/libc/arch/powerpc64/sys/sbrk.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbrk.S,v 1.2 2020/06/26 10:31:44 kettenis Exp $ */
+/* $OpenBSD: sbrk.S,v 1.3 2020/07/27 05:08:57 gkoehler Exp $ */
/*
* Copyright (c) 1996 Dale Rahn
@@ -28,9 +28,11 @@
#include "SYS.h"
.data
+ .globl _end
.globl __curbrk
.hidden __curbrk
__curbrk:
+ .quad _end
END(__curbrk)
.type __curbrk,@object
@@ -42,7 +44,7 @@ PSEUDO_PREFIX(,sbrk,break)
addis %r6, %r2, __curbrk@toc@ha
addi %r6, %r6, __curbrk@toc@l /* # %r6 = &__curbrk */
- lwz %r5, 0(%r6) /* # %r5 = *%r6 (old_curbrk) */
+ ld %r5, 0(%r6) /* # %r5 = *%r6 (old_curbrk) */
add %r3, %r5, %r3 /* # %r3 = new_curbrk */
mr %r7, %r3
@@ -57,7 +59,7 @@ PSEUDO_PREFIX(,sbrk,break)
/* update, __curbrk and return */
.L_sbrk_ok:
- stw %r7, 0(%r6) /* # remember, %r6=&__curbrk, %r7=new_curbrk */
+ std %r7, 0(%r6) /* # remember, %r6=&__curbrk, %r7=new_curbrk */
mr %r3, %r5 /* # remember, %r5=old_curbrk */
blr
END(sbrk)