Mercurial > repos > blastem
comparison mem.c @ 14:2bdad0f52f42
x86 code gen, initial work on translator
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 27 Nov 2012 09:28:13 -0800 |
parents | |
children | 3e7bfde7606e |
comparison
equal
deleted
inserted
replaced
13:168b1a873895 | 14:2bdad0f52f42 |
---|---|
1 #include <sys/mman.h> | |
2 #include <stddef.h> | |
3 #include "mem.h" | |
4 | |
5 void * alloc_code(size_t *size) | |
6 { | |
7 *size += PAGE_SIZE - (*size & (PAGE_SIZE - 1)); | |
8 return mmap(NULL, *size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | |
9 } | |
10 |