OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [sysdeps/] [or1k/] [__init_brk.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
#include <unistd.h>
2
#include <sys/syscall.h>
3
#include <errno.h>
4
#include <gnu-stabs.h>
5
 
6
void *___brk_addr = 0;
7
 
8
static inline
9
_syscall1(unsigned long, brk, unsigned long, brk);
10
 
11
int
12
__init_brk (void)
13
{
14
  if (___brk_addr == 0)
15
    {
16
      void tmp = 0;
17
      ___brk_addr = brk(tmp);
18
/*      register void *tmp asm ("%d1") = 0;
19
      __asm__ volatile ("movel %1,%/d0\n\t"
20
                        "trap #0\n\t"
21
                        "movel %/d0,%0"
22
                        : "=g" (___brk_addr)
23
                        : "i" (SYS_brk), "g" (tmp)
24
                        : "%d0");
25
*/
26
      if (___brk_addr == 0)
27
        {
28
          errno = ENOMEM;
29
          return -1;
30
        }
31
    }
32
  return 0;
33
}
34
 
35
weak_alias (___brk_addr, __curbrk);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.