1
0
mirror of https://github.com/golang/go synced 2024-11-21 19:14:44 -07:00

runtime: complete windows SysReserve

Should fix windows/386 build.

R=brainman
CC=golang-dev
https://golang.org/cl/4170041
This commit is contained in:
Russ Cox 2011-02-10 15:39:08 -05:00
parent 4774a19530
commit 12bdb29bdf

View File

@ -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