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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [sysdeps/] [or1k/] [__init_brk.c] - Rev 1765

Compare with Previous | Blame | View Log

#include <unistd.h>
#include <sys/syscall.h>
#include <errno.h>
#include <gnu-stabs.h>
 
void *___brk_addr = 0;
 
static inline
_syscall1(unsigned long, brk, unsigned long, brk);
 
int
__init_brk (void)
{
  if (___brk_addr == 0)
    {
      void tmp = 0;
      ___brk_addr = brk(tmp);
/*      register void *tmp asm ("%d1") = 0;
      __asm__ volatile ("movel %1,%/d0\n\t"
			"trap #0\n\t"
			"movel %/d0,%0"
			: "=g" (___brk_addr)
			: "i" (SYS_brk), "g" (tmp)
			: "%d0");
*/
      if (___brk_addr == 0)
	{
	  errno = ENOMEM;
	  return -1;
	}
    }
  return 0;
}
 
weak_alias (___brk_addr, __curbrk);
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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