summaryrefslogtreecommitdiff
path: root/mem_win.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2014-04-01 19:43:58 -0700
committerMichael Pavone <pavone@retrodev.com>2014-04-01 19:43:58 -0700
commitc51f057715587f133abe9bfb32d6d453a7af698b (patch)
treef35a343e06ab8ad3ad4652a97878d0b62402a6d0 /mem_win.c
parent4d15ffc63362410563a49481faf9652c138945ac (diff)
Initial work on Windows port
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);
+}