Mercurial > repos > blastem
diff mem_win.c @ 741:80a67be1770b
Initial work on Windows port
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 01 Apr 2014 19:43:58 -0700 |
parents | |
children | bce97fc0bb8a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mem_win.c Tue Apr 01 19:43:58 2014 -0700 @@ -0,0 +1,15 @@ +/* + Copyright 2013 Michael Pavone + This file is part of BlastEm. + BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. +*/ + +#include "mem.h" +#include <Windows.h> + +void * alloc_code(size_t *size) +{ + *size += PAGE_SIZE - (*size & (PAGE_SIZE - 1)); + + return VirtualAlloc(NULL, *size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); +}