aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/runtime/lfstack_64bit.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libgo/go/runtime/lfstack_64bit.go b/libgo/go/runtime/lfstack_64bit.go
index 213efb1..b314a3b 100644
--- a/libgo/go/runtime/lfstack_64bit.go
+++ b/libgo/go/runtime/lfstack_64bit.go
@@ -32,9 +32,18 @@ const (
// bottom, because node must be pointer-aligned, giving a total of 19 bits
// of count.
cntBits = 64 - addrBits + 3
+
+ // On sparc64-linux, user addresses are 52-bit numbers sign extended to 64.
+ // We shift the address left 12 to eliminate the sign extended part and make
+ // room in the bottom for the count.
+ sparcLinuxAddrBits = 52
+ sparcLinuxCntBits = 64 - sparcLinuxAddrBits + 3
)
func lfstackPack(node *lfnode, cnt uintptr) uint64 {
+ if GOARCH == "sparc64" && GOOS == "linux" {
+ return uint64(uintptr(unsafe.Pointer(node)))<<(64-sparcLinuxAddrBits) | uint64(cnt&(1<<sparcLinuxCntBits-1))
+ }
return uint64(uintptr(unsafe.Pointer(node)))<<(64-addrBits) | uint64(cnt&(1<<cntBits-1))
}
@@ -44,5 +53,8 @@ func lfstackUnpack(val uint64) *lfnode {
// val before unpacking.
return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> cntBits << 3)))
}
+ if GOARCH == "sparc64" && GOOS == "linux" {
+ return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> sparcLinuxCntBits << 3)))
+ }
return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3)))
}