]>
Commit | Line | Data |
---|---|---|
4cca6b86 UD |
1 | /* brk system call for Linux/ppc. |
2 | Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. | |
3 | This file is part of the GNU C Library. | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Library General Public License as | |
7 | published by the Free Software Foundation; either version 2 of the | |
8 | License, or (at your option) any later version. | |
9 | ||
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 | Library General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Library General Public | |
16 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
17 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
18 | Boston, MA 02111-1307, USA. */ | |
19 | ||
20 | #include <sysdep.h> | |
9a0a462c UD |
21 | #define _ERRNO_H 1 |
22 | #include <bits/errno.h> | |
23 | ||
24 | .comm __curbrk,4,4 | |
25 | .section ".text" | |
26 | ENTRY(__brk) | |
27 | stwu %r1,-16(%r1) | |
28 | stw %r3,8(%r1) | |
29 | DO_CALL(SYS_ify(brk)) | |
30 | lwz %r6,8(%r1) | |
31 | #ifdef PIC | |
32 | mflr %r4 | |
33 | bl _GLOBAL_OFFSET_TABLE_@local-4 | |
34 | mflr %r5 | |
35 | lwz %r5,__curbrk@got(%r5) | |
36 | mtlr %r4 | |
37 | stw %r3,0(%r5) | |
38 | #else | |
39 | stw %r3,__curbrk@sdarel(%r13) | |
40 | #endif | |
41 | cmplw %r6,%r3 | |
42 | addi %r1,%r1,16 | |
43 | li %r3,0 | |
44 | blelr+ | |
45 | li %r3,ENOMEM | |
46 | b JUMPTARGET(__syscall_error) | |
47 | END (__brk) | |
4cca6b86 | 48 | |
4cca6b86 | 49 | weak_alias (__brk, brk) |