2010-01-13 18:50:02 -07:00
|
|
|
// Copyright 2010 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "runtime.h"
|
|
|
|
#include "os.h"
|
|
|
|
#include "defs.h"
|
|
|
|
#include "malloc.h"
|
|
|
|
|
2010-09-07 07:57:22 -06:00
|
|
|
enum {
|
|
|
|
MEM_COMMIT = 0x1000,
|
|
|
|
MEM_RESERVE = 0x2000,
|
|
|
|
MEM_RELEASE = 0x8000,
|
|
|
|
|
|
|
|
PAGE_EXECUTE_READWRITE = 0x40,
|
|
|
|
};
|
|
|
|
|
2010-01-13 18:50:02 -07:00
|
|
|
void*
|
|
|
|
SysAlloc(uintptr n)
|
|
|
|
{
|
2010-09-07 07:57:22 -06:00
|
|
|
return stdcall(VirtualAlloc, 4, nil, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
2010-01-13 18:50:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SysUnused(void *v, uintptr n)
|
|
|
|
{
|
|
|
|
USED(v);
|
|
|
|
USED(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SysFree(void *v, uintptr n)
|
|
|
|
{
|
2010-09-08 20:09:10 -06:00
|
|
|
stdcall(VirtualFree, 3, v, n, MEM_RELEASE);
|
2010-01-13 18:50:02 -07:00
|
|
|
}
|
2010-09-28 18:30:01 -06:00
|
|
|
|
|
|
|
void
|
|
|
|
SysMemInit(void)
|
|
|
|
{
|
|
|
|
}
|