-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhppalloc.h
32 lines (23 loc) · 936 Bytes
/
hppalloc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef HPPALLOC_H
#define HPPALLOC_H
#include <stddef.h>
/* Try to allocate with malloc (if everything else fails). */
#define HPPA_AS_MALLOC (1 << 0)
/* Allocate memory from the anonymous hugetable heap. */
#define HPPA_AS_ANON (1 << 1)
/* Allocate memory from the named/file-backed (e.g. pmem) heap. */
/* If the named heap is enabled, it overrides the anoymous heap even if enabled. */
#define HPPA_AS_NAMED (1 << 2)
#define HPPA_AS_PMEM HPPA_AS_NAMED
#define HPPA_AS_MAX (2)
#define HPPA_AS_MASK ((1 << (HPPA_AS_MAX + 1)) - 1)
#define HPPA_AS_ALL HPPA_AS_MASK
/* convenience flags */
#define HPPA_AS_NO_MALLOC (~HPPA_AS_MALLOC & HPPA_AS_MASK)
#define HPPA_AS_NO_ANON (~HPPA_AS_ANON & HPPA_AS_MASK)
#define HPPA_AS_NO_NAMED (~HPPA_AS_NAMED & HPPA_AS_MASK)
/* set the mode and return the old one */
int hpp_set_mode(int mode);
void* hpp_alloc(size_t n, size_t elem_size);
void hpp_free(void *ptr);
#endif