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