diff options
author | Russ Cox <rsc@golang.org> | 2011-02-10 15:39:08 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-02-10 15:39:08 -0500 |
commit | 12bdb29bdf080af43ba7688ae5af4053eb4f7288 (patch) | |
tree | f835852d993c116b5e9b3b2ca78bdffec82087a5 | |
parent | 4774a195307acf2660847fc5a819e625fc67b782 (diff) | |
download | go-12bdb29bdf080af43ba7688ae5af4053eb4f7288.tar.gz go-12bdb29bdf080af43ba7688ae5af4053eb4f7288.zip |
runtime: complete windows SysReserve
Should fix windows/386 build.
R=brainman
CC=golang-dev
https://golang.org/cl/4170041
-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 c523195a46..54d77da37e 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, PAGE_EXECUTE_READWRITE); + // 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 |