]>
Commit | Line | Data |
---|---|---|
d2f5be2a | 1 | /* Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation, Inc. |
28f540f4 RM |
2 | This file is part of the GNU C Library. |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Library General Public License as | |
6 | published by the Free Software Foundation; either version 2 of the | |
7 | License, or (at your option) any later version. | |
8 | ||
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Library General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Library General Public | |
15 | License along with the GNU C Library; see the file COPYING.LIB. If | |
16 | not, write to the Free Software Foundation, Inc., 675 Mass Ave, | |
17 | Cambridge, MA 02139, USA. */ | |
18 | ||
19 | #include <sysdep.h> | |
20 | ||
d2f5be2a UD |
21 | .data |
22 | .globl C_SYMBOL_NAME(__curbrk) | |
23 | C_LABEL(__curbrk) | |
d2f5be2a | 24 | .long C_SYMBOL_NAME(_end) |
d2f5be2a UD |
25 | |
26 | .text | |
d2f5be2a | 27 | |
c14e4c32 | 28 | SYSCALL_ERROR_HANDLER |
d2f5be2a UD |
29 | ENTRY (__brk) |
30 | movl %ebx, %edx | |
31 | movl $SYS_ify(brk), %eax | |
32 | movl 4(%esp), %ebx | |
33 | int $0x80 | |
34 | movl %edx, %ebx | |
35 | ||
36 | cmpl 4(%esp), %eax | |
efc755b2 | 37 | jne syscall_error |
d2f5be2a UD |
38 | |
39 | #ifdef PIC | |
40 | /* Standard PIC nonsense to store into `__curbrk' through the GOT. */ | |
41 | call here | |
42 | here: popl %ecx | |
43 | addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx | |
44 | movl C_SYMBOL_NAME(__curbrk@GOT)(%ecx), %ecx | |
45 | movl %eax, (%ecx) | |
46 | #else | |
47 | movl %eax, C_SYMBOL_NAME(__curbrk) | |
48 | #endif | |
49 | xorl %eax, %eax | |
28f540f4 RM |
50 | ret |
51 | ||
d2f5be2a | 52 | weak_alias (__brk, brk) |