comparison 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
comparison
equal deleted inserted replaced
589:2dde38c1744f 741:80a67be1770b
1 /*
2 Copyright 2013 Michael Pavone
3 This file is part of BlastEm.
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
5 */
6
7 #include "mem.h"
8 #include <Windows.h>
9
10 void * alloc_code(size_t *size)
11 {
12 *size += PAGE_SIZE - (*size & (PAGE_SIZE - 1));
13
14 return VirtualAlloc(NULL, *size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
15 }