diff options
Diffstat (limited to 'src/pkg/runtime/plan9/mem.c')
| -rw-r--r-- | src/pkg/runtime/plan9/mem.c | 29 | 
1 files changed, 18 insertions, 11 deletions
| diff --git a/src/pkg/runtime/plan9/mem.c b/src/pkg/runtime/plan9/mem.c index 651e6728e..b840de984 100644 --- a/src/pkg/runtime/plan9/mem.c +++ b/src/pkg/runtime/plan9/mem.c @@ -10,40 +10,47 @@ static byte *bloc = { end };  enum  { -	Round = 7 +	Round = 4095  };  void* -runtime·SysAlloc(uintptr ask) +runtime·SysAlloc(uintptr nbytes)  {  	uintptr bl;  	// Plan 9 sbrk from /sys/src/libc/9sys/sbrk.c  	bl = ((uintptr)bloc + Round) & ~Round; -	if(runtime·brk_((void*)(bl + ask)) < 0) +	if(runtime·brk_((void*)(bl + nbytes)) < 0)  		return (void*)-1; -	bloc = (byte*)bl + ask; +	bloc = (byte*)bl + nbytes;  	return (void*)bl;  }  void -runtime·SysFree(void *v, uintptr n) +runtime·SysFree(void *v, uintptr nbytes)  {  	// from tiny/mem.c  	// Push pointer back if this is a free  	// of the most recent SysAlloc. -	n += (n + Round) & ~Round; -	if(bloc == (byte*)v+n) -		bloc -= n;	 +	nbytes += (nbytes + Round) & ~Round; +	if(bloc == (byte*)v+nbytes) +		bloc -= nbytes;	  }  void -runtime·SysUnused(void *v, uintptr n) +runtime·SysUnused(void *v, uintptr nbytes)  { -	USED(v, n); +	USED(v, nbytes);  }  void -runtime·SysMemInit(void) +runtime·SysMap(void *v, uintptr nbytes)  { +	USED(v, nbytes); +} + +void* +runtime·SysReserve(void *v, uintptr nbytes) +{ +	return runtime·SysAlloc(nbytes);  } | 
