diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-02-18 09:50:58 +0100 | 
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-02-18 09:50:58 +0100 | 
| commit | c072558b90f1bbedc2022b0f30c8b1ac4712538e (patch) | |
| tree | 67767591619e4bd8111fb05fac185cde94fb7378 /src/pkg/runtime/windows/mem.c | |
| parent | 5859517b767c99749a45651c15d4bae5520ebae8 (diff) | |
| download | golang-c072558b90f1bbedc2022b0f30c8b1ac4712538e.tar.gz | |
Imported Upstream version 2011.02.15upstream/2011.02.15
Diffstat (limited to 'src/pkg/runtime/windows/mem.c')
| -rw-r--r-- | src/pkg/runtime/windows/mem.c | 9 | 
1 files changed, 8 insertions, 1 deletions
| diff --git a/src/pkg/runtime/windows/mem.c b/src/pkg/runtime/windows/mem.c index 19d11ce8d..54d77da37 100644 --- a/src/pkg/runtime/windows/mem.c +++ b/src/pkg/runtime/windows/mem.c @@ -48,7 +48,14 @@ runtime·SysFree(void *v, uintptr n)  void*  runtime·SysReserve(void *v, uintptr n)  { -	return runtime·stdcall(runtime·VirtualAlloc, 4, v, n, MEM_RESERVE, 0); +	// v is just a hint. +	// First try at v. +	v = runtime·stdcall(runtime·VirtualAlloc, 4, v, n, MEM_RESERVE, PAGE_EXECUTE_READWRITE); +	if(v != nil) +		return v; +	 +	// Next let the kernel choose the address. +	return runtime·stdcall(runtime·VirtualAlloc, 4, nil, n, MEM_RESERVE, PAGE_EXECUTE_READWRITE);  }  void | 
