41397701 |
1 | #include <stdio.h> |
7f5a3fc1 |
2 | #ifdef __linux__ |
41397701 |
3 | #include <sys/mman.h> |
4 | #endif |
5 | |
6 | #include "cmn.h" |
7 | |
f4bb5d6b |
8 | u8 __attribute__((aligned(4096))) tcache[DRC_TCACHE_SIZE]; |
41397701 |
9 | |
10 | |
11 | void drc_cmn_init(void) |
12 | { |
7f5a3fc1 |
13 | #ifdef __linux__ |
41397701 |
14 | void *tmp; |
15 | |
a736af3e |
16 | tmp = mmap(tcache, DRC_TCACHE_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); |
41397701 |
17 | printf("mmap tcache: %p, asked %p\n", tmp, tcache); |
18 | #endif |
41397701 |
19 | } |
20 | |
41397701 |
21 | void drc_cmn_cleanup(void) |
22 | { |
7f5a3fc1 |
23 | #ifdef __linux__ |
41397701 |
24 | int ret; |
679af8a3 |
25 | ret = munmap(tcache, DRC_TCACHE_SIZE); |
41397701 |
26 | printf("munmap tcache: %i\n", ret); |
27 | #endif |
28 | } |
29 | |