diff options
author | Michael Pavone <pavone@retrodev.com> | 2015-05-28 23:05:32 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2015-05-28 23:05:32 -0700 |
commit | d597043be9f8d1c22ac6a2365e5cbb9f82e7ea46 (patch) | |
tree | 131c7ea0f3ec03882bb8183a734f04c757918180 /mem_win.c | |
parent | 391656eca9eb35b7e3937b2af1316460d5639306 (diff) | |
parent | 66aedc9c1a87c8811be4dba263dbcd7ec026cc70 (diff) |
Merge
Diffstat (limited to 'mem_win.c')
-rw-r--r-- | mem_win.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mem_win.c b/mem_win.c new file mode 100644 index 0000000..8a76712 --- /dev/null +++ b/mem_win.c @@ -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); +} |