summaryrefslogtreecommitdiff
path: root/mem_win.c
diff options
context:
space:
mode:
Diffstat (limited to 'mem_win.c')
-rw-r--r--mem_win.c15
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);
+}