* config/msp430/msp430.md (zero_extendhipsi2): Use MOVX.A to store
[official-gcc.git] / libgo / runtime / mem_posix_memalign.c
blob8acdf0705700903cb455263404a07eab64cdd6a6
1 #include <errno.h>
3 #include "runtime.h"
4 #include "arch.h"
5 #include "malloc.h"
7 void*
8 runtime_SysAlloc(uintptr n)
10 void *p;
12 mstats.sys += n;
13 errno = posix_memalign(&p, PageSize, n);
14 if (errno > 0) {
15 perror("posix_memalign");
16 exit(2);
18 return p;
21 void
22 runtime_SysUnused(void *v, uintptr n)
24 USED(v);
25 USED(n);
26 // TODO(rsc): call madvise MADV_DONTNEED
29 void
30 runtime_SysFree(void *v, uintptr n)
32 mstats.sys -= n;
33 free(v);
36 void*
37 runtime_SysReserve(void *v, uintptr n)
39 USED(v);
40 return runtime_SysAlloc(n);
43 void
44 runtime_SysMap(void *v, uintptr n)
46 USED(v);
47 USED(n);