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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [sysdeps/] [m68k/] [__sbrk.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
 
5
extern void * ___brk_addr;
6
 
7
extern int __init_brk (void);
8
 
9
void *
10
__sbrk(ptrdiff_t increment)
11
{
12
    if (__init_brk () == 0)
13
    {
14
        register void * tmp asm ("%d1") = ___brk_addr+increment;
15
        __asm__ volatile ("movel %1,%/d0\n\t"
16
                          "trap  #0\n\t"
17
                          "movel %/d0,%0"
18
                :"=g" (___brk_addr)
19
                :"i" (SYS_brk),"g" (tmp) : "%d0");
20
        if (___brk_addr == tmp)
21
                return tmp-increment;
22
        errno = ENOMEM;
23
    }
24
    return ((void *) -1);
25
}
26
 
27
#include <gnu-stabs.h>
28
#ifdef weak_alias
29
weak_alias (__sbrk, sbrk);
30
#endif

powered by: WebSVN 2.1.0

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