| // 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. |
| static byte *bloc = { end }; |
| runtime·SysAlloc(uintptr nbytes) |
| // Plan 9 sbrk from /sys/src/libc/9sys/sbrk.c |
| bl = ((uintptr)bloc + Round) & ~Round; |
| if(runtime·brk_((void*)(bl + nbytes)) < 0) { |
| runtime·unlock(&memlock); |
| bloc = (byte*)bl + nbytes; |
| runtime·unlock(&memlock); |
| runtime·SysFree(void *v, uintptr nbytes) |
| // Push pointer back if this is a free |
| // of the most recent SysAlloc. |
| nbytes += (nbytes + Round) & ~Round; |
| if(bloc == (byte*)v+nbytes) |
| runtime·unlock(&memlock); |
| runtime·SysUnused(void *v, uintptr nbytes) |
| runtime·SysMap(void *v, uintptr nbytes) |
| runtime·SysReserve(void *v, uintptr nbytes) |
| return runtime·SysAlloc(nbytes); |