drc: some portability fixes

This commit is contained in:
notaz 2013-06-28 01:41:52 +03:00
parent 2446536be5
commit c25d78eec1
5 changed files with 36 additions and 22 deletions

View file

@ -6,10 +6,8 @@
* See COPYING file in the top-level directory.
*/
#include <stdio.h>
#ifdef __linux__
#include <sys/mman.h>
#endif
#include <pico/pico.h>
#include "cmn.h"
u8 __attribute__((aligned(4096))) tcache[DRC_TCACHE_SIZE];
@ -17,20 +15,9 @@ u8 __attribute__((aligned(4096))) tcache[DRC_TCACHE_SIZE];
void drc_cmn_init(void)
{
#ifdef __linux__
void *tmp;
tmp = mmap(tcache, DRC_TCACHE_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
printf("mmap tcache: %p, asked %p\n", tmp, tcache);
#endif
plat_mem_set_exec(tcache, sizeof(tcache));
}
void drc_cmn_cleanup(void)
{
#ifdef __linux__
int ret;
ret = munmap(tcache, DRC_TCACHE_SIZE);
printf("munmap tcache: %i\n", ret);
#endif
}