5 //#include <psp2/kernel/sysmem.h>
11 #define PROT_READ 0b001
12 #define PROT_WRITE 0b010
13 #define PROT_EXEC 0b100
15 #define MAP_ANONYMOUS 0x20
17 #define MAP_FAILED ((void *)-1)
20 static inline void* mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
29 block = sceKernelAllocMemBlockForVM("code", len);
31 sceClibPrintf("could not alloc mem block @0x%08X 0x%08X \n", block, len);
36 ret = sceKernelGetMemBlockBase(block, &addr);
39 sceClibPrintf("could get address @0x%08X 0x%08X \n", block, addr);
50 static inline int mprotect(void *addr, size_t len, int prot)
58 static inline int munmap(void *addr, size_t len)
60 int uid = sceKernelFindMemBlockByAddr(addr, len);
62 return sceKernelFreeMemBlock(uid);