summaryrefslogtreecommitdiff
path: root/lib/libc/arch/powerpc/sys/sbrk.S
diff options
context:
space:
mode:
authorDale S. Rahn <rahnds@cvs.openbsd.org>1996-12-21 20:42:25 +0000
committerDale S. Rahn <rahnds@cvs.openbsd.org>1996-12-21 20:42:25 +0000
commit18bfa0d968e3c3bb24239eaf982fb33bb185bf19 (patch)
tree0e19e42e1017544442510644e798db671db46527 /lib/libc/arch/powerpc/sys/sbrk.S
parent3a2ca69baba476e6254a1a232cab2d0981b68db3 (diff)
Check-in of powerpc library support.
NOTE: This will not work until the other pieces are checked in. This is primarily the NetBSD powerpc port, with modifications to support ELF.
Diffstat (limited to 'lib/libc/arch/powerpc/sys/sbrk.S')
-rw-r--r--lib/libc/arch/powerpc/sys/sbrk.S32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/libc/arch/powerpc/sys/sbrk.S b/lib/libc/arch/powerpc/sys/sbrk.S
new file mode 100644
index 00000000000..c54fa839e8a
--- /dev/null
+++ b/lib/libc/arch/powerpc/sys/sbrk.S
@@ -0,0 +1,32 @@
+#include "SYS.h"
+
+ .data
+ .globl _end
+ .globl curbrk
+ .globl minbrk
+curbrk: .long _end
+minbrk: .long _end
+
+
+ .text
+PSEUDO_PREFIX(sbrk,break)
+
+ /* call break(curbrk + size) */
+ addis 6,0,curbrk@h
+ ori 6,6,curbrk@l /* # 6 = &curbrk */
+ lwz 5, 0(6) /* # 5 = *6 (old_curbrk) */
+ add 3, 5, 3 /* # 3 = new_curbrk */
+ mr 7, 3
+
+ sc
+
+ /* check for error */
+ cmpwi 0, 0
+ beq+ sbrk_ok /* OK so this is stupid but I haven't read b */
+ b cerror
+
+ /* update, curbrk and return */
+sbrk_ok:
+ stw 7, 0(6) /* # remember, 6=&curbrk, 7=new_curbrk */
+ mr 3, 5 /* # remember, 5=old_curbrk */
+ blr