2 * Copyright (C) 2016 Andes Technology, Inc.
3 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 /* brk system call for Linux/NDS32.
7 Copyright (C) 1995, 1996 Free Software Foundation, Inc.
9 The GNU C Library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
14 The GNU C Library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with the GNU C Library; if not, write to the Free
21 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 #include <sys/syscall.h>
28 /* This must be initialized data because commons can't have aliases. */
29 void *__curbrk attribute_hidden
= 0;
31 libc_hidden_proto(brk
)
38 __asm__
__volatile__ ("move $r0, %1 \n\t" // save the argment in r0
40 "sethi $r7, hi20(%2)\n\t" // put the syscall number in r7
41 "ori $r7, $r7, lo12(%2)\n\t"
42 "syscall 0x7fff \n\t" // do the system call
44 "move %0, $r5 \n\t" // keep the return value
46 : "r"(addr
), "i"(SYS_ify(brk
))
49 __asm__
__volatile__ ("move $r0, %1 \n\t" // save the argment in r0
50 "syscall %2 \n\t" // do the system call
51 "move %0, $r0 \n\t" // keep the return value
53 : "r"(addr
), "i"(SYS_ify(brk
))