diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-08-29 18:59:04 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-08-29 18:59:04 +0000 |
commit | 762696920bbee2d6165b4ddf7386fb9f5b81e760 (patch) | |
tree | 1a6c55e2682a3c977bbf937160cdb3fec6dd3ec9 /libgo | |
parent | c09949646bbfdc82b6c97a0ab716e6b4739bf235 (diff) | |
download | gcc-762696920bbee2d6165b4ddf7386fb9f5b81e760.tar.gz |
runtime: fix lfstack for 64-bit AIX
Reviewed-on: https://go-review.googlesource.com/57550
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251420 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/go/runtime/lfstack_64bit.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libgo/go/runtime/lfstack_64bit.go b/libgo/go/runtime/lfstack_64bit.go index 3d5588df558..44cbf74cae0 100644 --- a/libgo/go/runtime/lfstack_64bit.go +++ b/libgo/go/runtime/lfstack_64bit.go @@ -43,6 +43,14 @@ const ( // 52 address bits each (with 64k page size). ia64AddrBits = 55 ia64CntBits = 64 - ia64AddrBits + 3 + + // On AIX, 64-bit addresses are split into 36-bit segment number and 28-bit + // offset in segment. Segment numbers in the range 0x070000000-0x07FFFFFFF + // and 0x0A0000000-0x0AFFFFFFF(LSA) are available for mmap. + // We assume all lfnode addresses are from memory allocated with mmap. + // We use one bit to distinguish between the two ranges. + aixAddrBits = 57 + aixCntBits = 64 - aixAddrBits + 3 ) func lfstackPack(node *lfnode, cnt uintptr) uint64 { @@ -54,6 +62,9 @@ func lfstackPack(node *lfnode, cnt uintptr) uint64 { val := uint64(uintptr(unsafe.Pointer(node))) return (val<<(64-ia64AddrBits))&(1<<(64-3)-1) | val&^(1<<(64-3)-1) | uint64(cnt&(1<<ia64CntBits-1)) } + if GOARCH == "ppc64" && GOOS == "aix" { + return uint64(uintptr(unsafe.Pointer(node)))<<(64-aixAddrBits) | uint64(cnt&(1<<aixCntBits-1)) + } return uint64(uintptr(unsafe.Pointer(node)))<<(64-addrBits) | uint64(cnt&(1<<cntBits-1)) } @@ -69,5 +80,12 @@ func lfstackUnpack(val uint64) *lfnode { if GOARCH == "ia64" { return (*lfnode)(unsafe.Pointer(uintptr((val>>ia64CntBits<<3)&(1<<(64-3)-1) | val&^(1<<(64-3)-1)))) } + if GOARCH == "ppc64" && GOOS == "aix" { + if val&(1<<63) != 0 { + return (*lfnode)(unsafe.Pointer(uintptr((val >> aixCntBits << 3) | 0x7<<56))) + } else { + return (*lfnode)(unsafe.Pointer(uintptr((val >> aixCntBits << 3) | 0xa<<56))) + } + } return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3))) } |