2.9
[glibc/nacl-glibc.git] / sysdeps / unix / sysv / linux / powerpc / powerpc64 / brk.S
blobf2ac00d4c7288ca2c468b4685c29f7cb3143ed8d
1 /* brk system call for Linux.  PowerPC64 version.
2    Copyright (C) 1995,96,97,99, 2000,02, 2006 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
18    02110-1301 USA.  */
20 #include <sysdep.h>
21 #define _ERRNO_H        1
22 #include <bits/errno.h>
23 #include <bp-sym.h>
24 #include <bp-asm.h>
26         .comm   __curbrk,8,8
27         .section        ".toc","aw"
28 .LC__curbrk:
29         .tc __curbrk[TC],__curbrk
30         .section ".text"
31 ENTRY (BP_SYM (__brk))
32         CALL_MCOUNT 1
33         DISCARD_BOUNDS (r3)     /* the bounds are meaningless, so toss 'em.  */
35         stdu    r1,-64(r1)
36         cfi_adjust_cfa_offset (64)
37         std     r3,48(r1)
38         DO_CALL(SYS_ify(brk))
39         ld     r6,48(r1)
40         ld      r5,.LC__curbrk@toc(r2)
41         std     r3,0(r5)
42         cmpld   r6,r3
43         addi    r1,r1,64
44         li      r3,0
45         blelr+
46         li      r3,ENOMEM
47         b       JUMPTARGET(__syscall_error)
48 END (BP_SYM (__brk))
50 weak_alias (BP_SYM (__brk), BP_SYM (brk))