diff options
| author | Aram Hăvărneanu <aram@mgk.ro> | 2015-03-08 14:20:20 +0100 |
|---|---|---|
| committer | Aram Hăvărneanu <aram@mgk.ro> | 2015-03-16 18:45:54 +0000 |
| commit | 846ee0465bcb97d0c036e2366aa92b962d050aef (patch) | |
| tree | e0e09a6fd3fea33672e53cb2aebd6b9191be244f /src/runtime/malloc.go | |
| parent | 5a0c322bce0e471df23b224547932dd95c285c54 (diff) | |
| download | go-846ee0465bcb97d0c036e2366aa92b962d050aef.tar.xz | |
runtime: add support for linux/arm64
Change-Id: Ibda6a5bedaff57fd161d63fc04ad260931d34413
Reviewed-on: https://go-review.googlesource.com/7142
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
| -rw-r--r-- | src/runtime/malloc.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index c33456258f..0b7b89a404 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -253,12 +253,20 @@ func mallocinit() { // but it hardly matters: e0 00 is not valid UTF-8 either. // // If this fails we fall back to the 32 bit memory mechanism + // + // However, on arm64, we ignore all this advice above and slam the + // allocation at 0x40 << 32 because when using 4k pages with 3-level + // translation buffers, the user address space is limited to 39 bits arenaSize := round(_MaxMem, _PageSize) bitmapSize = arenaSize / (ptrSize * 8 / 4) spansSize = arenaSize / _PageSize * ptrSize spansSize = round(spansSize, _PageSize) for i := 0; i <= 0x7f; i++ { - p = uintptr(i)<<40 | uintptrMask&(0x00c0<<32) + if GOARCH == "arm64" { + p = uintptr(i)<<40 | uintptrMask&(0x0040<<32) + } else { + p = uintptr(i)<<40 | uintptrMask&(0x00c0<<32) + } pSize = bitmapSize + spansSize + arenaSize + _PageSize p = uintptr(sysReserve(unsafe.Pointer(p), pSize, &reserved)) if p != 0 { |
