aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.goc
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-02-11 14:32:34 -0500
committerRuss Cox <rsc@golang.org>2011-02-11 14:32:34 -0500
commit48535ae3f10e685f2385b67dbcc3037e8c297b5f (patch)
tree31e3b0c189b77fbbefc3c89588d147a7098121b4 /src/pkg/runtime/malloc.goc
parent7e77623120105b51f4a348d56798cb49007de029 (diff)
downloadgo-48535ae3f10e685f2385b67dbcc3037e8c297b5f.tar.xz
runtime: check that SysReserve returns aligned memory
R=iant, iant2 CC=golang-dev https://golang.org/cl/4180043
Diffstat (limited to 'src/pkg/runtime/malloc.goc')
-rw-r--r--src/pkg/runtime/malloc.goc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc
index 18652d71a6..70b85d68d7 100644
--- a/src/pkg/runtime/malloc.goc
+++ b/src/pkg/runtime/malloc.goc
@@ -297,6 +297,9 @@ runtime·mallocinit(void)
if(p == nil)
runtime·throw("runtime: cannot reserve arena virtual address space");
}
+ if((uintptr)p & (((uintptr)1<<PageShift)-1))
+ runtime·throw("runtime: SysReserve returned unaligned address");
+
runtime·mheap.bitmap = p;
runtime·mheap.arena_start = p + bitmap_size;
runtime·mheap.arena_used = runtime·mheap.arena_start;