minix/lib/libc/arch/powerpc/sys/brk.S
Lionel Sambuc 84d9c625bf Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
2014-07-28 17:05:06 +02:00

51 lines
984 B
ArmAsm

/* $NetBSD: brk.S,v 1.13 2013/09/12 15:36:15 joerg Exp $ */
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: brk.S,v 1.13 2013/09/12 15:36:15 joerg Exp $")
#endif /* LIBC_SCCS && !lint */
.globl _C_LABEL(__curbrk)
.globl _C_LABEL(__minbrk)
.globl _C_LABEL(_end)
#ifdef WEAK_ALIAS
WEAK_ALIAS(brk, _brk)
#endif
.data
_C_LABEL(__minbrk):
.long _C_LABEL(_end) # XXX not used yet
.text
ENTRY(_brk)
#ifdef __PIC__
mflr %r10
PIC_GOTSETUP(%r9)
mtlr %r10
lwz %r5,_C_LABEL(_end)@got(%r9)
#else
lis %r5,_C_LABEL(_end)@ha # r5 = &_end
addi %r5,%r5,_C_LABEL(_end)@l
#endif
cmplw %r5,%r3 # if (&_end <= r3)
bgt 0f
mr %r5,%r3 # r5 = r3
0:
mr %r3,%r5 # new break value
_DOSYSCALL(break) # assume, that r5 is kept
bso 1f
#ifdef __PIC__
lwz %r6,_C_LABEL(__curbrk)@got(%r9)
stw %r5,0(%r6)
#else
lis %r6,_C_LABEL(__curbrk)@ha # record new break
stw %r5,_C_LABEL(__curbrk)@l(%r6)
#endif
blr # return 0
1:
b _C_LABEL(__cerror)
END(_brk)