Commit aa549311 by Ian Lance Taylor

runtime: support ia64 in lfstack

    
    Patch by Andreas Schwab.
    
    Reviewed-on: https://go-review.googlesource.com/45071

From-SVN: r248994
parent bfd88d1d
7e3904e4370ccfd9062c2661c612476288244e17 eaf4afbabcd91df55d31955500b6db55b07f6de5
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha mipsn64 sparc64 // +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha mipsn64 sparc64 ia64
package runtime package runtime
...@@ -38,12 +38,22 @@ const ( ...@@ -38,12 +38,22 @@ const (
// room in the bottom for the count. // room in the bottom for the count.
sparcLinuxAddrBits = 52 sparcLinuxAddrBits = 52
sparcLinuxCntBits = 64 - sparcLinuxAddrBits + 3 sparcLinuxCntBits = 64 - sparcLinuxAddrBits + 3
// On IA64, the virtual address space is devided into 8 regions, with
// 52 address bits each (with 64k page size).
ia64AddrBits = 55
ia64CntBits = 64 - ia64AddrBits + 3
) )
func lfstackPack(node *lfnode, cnt uintptr) uint64 { func lfstackPack(node *lfnode, cnt uintptr) uint64 {
if GOARCH == "sparc64" && GOOS == "linux" { 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-sparcLinuxAddrBits) | uint64(cnt&(1<<sparcLinuxCntBits-1))
} }
if GOARCH == "ia64" {
// Top three bits are the region number
val := uint64(uintptr(unsafe.Pointer(node)))
return (val<<(64-ia64AddrBits))&(1<<(64-3)-1) | val&^(1<<(64-3)-1) | uint64(cnt&(1<<ia64CntBits-1))
}
return uint64(uintptr(unsafe.Pointer(node)))<<(64-addrBits) | uint64(cnt&(1<<cntBits-1)) return uint64(uintptr(unsafe.Pointer(node)))<<(64-addrBits) | uint64(cnt&(1<<cntBits-1))
} }
...@@ -56,5 +66,8 @@ func lfstackUnpack(val uint64) *lfnode { ...@@ -56,5 +66,8 @@ func lfstackUnpack(val uint64) *lfnode {
if GOARCH == "sparc64" && GOOS == "linux" { if GOARCH == "sparc64" && GOOS == "linux" {
return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> sparcLinuxCntBits << 3))) return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> sparcLinuxCntBits << 3)))
} }
if GOARCH == "ia64" {
return (*lfnode)(unsafe.Pointer(uintptr((val>>ia64CntBits<<3)&(1<<(64-3)-1) | val&^(1<<(64-3)-1))))
}
return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3))) return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3)))
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment