1 /* brk system call for Linux/i386.
2 Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
3 Copyright (c) 2015 mirabilos <tg@mirbsd.org>
4 This file is part of uclibc-ng, derived from the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
22 #include <sys/syscall.h>
24 /* This must be initialized data because commons can't have aliases. */
25 void *__curbrk attribute_hidden
= 0;
32 * EBC is used in PIC code, we need to save/restore it manually.
33 * Unfortunately, GCC won't do that for us even if we use con-
34 * straints, and we cannot push it either as ESP clobbers are
35 * silently ignored, but EDX is preserved, so it's scratch space.
37 __asm__("xchgl %%edx,%%ebx"
39 "\n xchgl %%edx,%%ebx"
41 : "0" (__NR_brk
), "d" (addr
)