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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [runtime/] [mem_posix_memalign.c] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
#include <errno.h>
2
 
3
#include "runtime.h"
4
#include "arch.h"
5
#include "malloc.h"
6
 
7
void*
8
runtime_SysAlloc(uintptr n)
9
{
10
        void *p;
11
 
12
        mstats.sys += n;
13
        errno = posix_memalign(&p, PageSize, n);
14
        if (errno > 0) {
15
                perror("posix_memalign");
16
                exit(2);
17
        }
18
        return p;
19
}
20
 
21
void
22
runtime_SysUnused(void *v, uintptr n)
23
{
24
        USED(v);
25
        USED(n);
26
        // TODO(rsc): call madvise MADV_DONTNEED
27
}
28
 
29
void
30
runtime_SysFree(void *v, uintptr n)
31
{
32
        mstats.sys -= n;
33
        free(v);
34
}
35
 
36
void*
37
runtime_SysReserve(void *v, uintptr n)
38
{
39
        USED(v);
40
        return runtime_SysAlloc(n);
41
}
42
 
43
void
44
runtime_SysMap(void *v, uintptr n)
45
{
46
        USED(v);
47
        USED(n);
48
}

powered by: WebSVN 2.1.0

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