]> sourceware.org Git - glibc.git/blob - sysdeps/unix/sysv/linux/i386/brk.S
754ec5ef09e2475fbd29dd1bd9d6c9a27813a180
[glibc.git] / sysdeps / unix / sysv / linux / i386 / brk.S
1 /* Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation, Inc.
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
21 .data
22 .globl C_SYMBOL_NAME(__curbrk)
23 C_LABEL(__curbrk)
24 #ifdef PIC
25 .long 0
26 #else
27 # ifdef HAVE_GNU_LD
28 .long C_SYMBOL_NAME(_end)
29 # else
30 .long C_SYMBOL_NAME(end)
31 # endif
32 #endif
33
34 .text
35
36 SYSCALL_ERROR_HANDLER
37 ENTRY (__brk)
38 movl %ebx, %edx
39 movl $SYS_ify(brk), %eax
40 movl 4(%esp), %ebx
41 int $0x80
42 movl %edx, %ebx
43
44 cmpl 4(%esp), %eax
45 jne syscall_error
46
47 #ifdef PIC
48 /* Standard PIC nonsense to store into `__curbrk' through the GOT. */
49 call here
50 here: popl %ecx
51 addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx
52 movl C_SYMBOL_NAME(__curbrk@GOT)(%ecx), %ecx
53 movl %eax, (%ecx)
54 #else
55 movl %eax, C_SYMBOL_NAME(__curbrk)
56 #endif
57 xorl %eax, %eax
58 ret
59
60 weak_alias (__brk, brk)
This page took 0.04009 seconds and 4 git commands to generate.