summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/plan9/mem.c
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-02-18 09:50:58 +0100
committerOndřej Surý <ondrej@sury.org>2011-02-18 09:53:27 +0100
commit91664defe0a75da15661a37a7f585b0c8523bf4e (patch)
tree8d7133037ce477c00ba0408d3f0892e0a8b5744d /src/pkg/runtime/plan9/mem.c
parentac2d3c9eb73a2d23848c55c3171d8ff6dd0feed9 (diff)
downloadgolang-91664defe0a75da15661a37a7f585b0c8523bf4e.tar.gz
Imported Upstream version 2011.02.15
Diffstat (limited to 'src/pkg/runtime/plan9/mem.c')
-rw-r--r--src/pkg/runtime/plan9/mem.c29
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);
}