File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -36,12 +36,21 @@ const (
36
36
// We use one bit to distinguish between the two ranges.
37
37
aixAddrBits = 57
38
38
aixCntBits = 64 - aixAddrBits + 3
39
+
40
+ // riscv64 SV57 mode gives 56 bits of userspace VA.
41
+ // lfstack code supports it, but broader support for SV57 mode is incomplete,
42
+ // and there may be other issues (see #54104).
43
+ riscv64AddrBits = 56
44
+ riscv64CntBits = 64 - riscv64AddrBits + 3
39
45
)
40
46
41
47
func lfstackPack (node * lfnode , cnt uintptr ) uint64 {
42
48
if GOARCH == "ppc64" && GOOS == "aix" {
43
49
return uint64 (uintptr (unsafe .Pointer (node )))<< (64 - aixAddrBits ) | uint64 (cnt & (1 << aixCntBits - 1 ))
44
50
}
51
+ if GOARCH == "riscv64" {
52
+ return uint64 (uintptr (unsafe .Pointer (node )))<< (64 - riscv64AddrBits ) | uint64 (cnt & (1 << riscv64CntBits - 1 ))
53
+ }
45
54
return uint64 (uintptr (unsafe .Pointer (node )))<< (64 - addrBits ) | uint64 (cnt & (1 << cntBits - 1 ))
46
55
}
47
56
@@ -54,5 +63,8 @@ func lfstackUnpack(val uint64) *lfnode {
54
63
if GOARCH == "ppc64" && GOOS == "aix" {
55
64
return (* lfnode )(unsafe .Pointer (uintptr ((val >> aixCntBits << 3 ) | 0xa << 56 )))
56
65
}
66
+ if GOARCH == "riscv64" {
67
+ return (* lfnode )(unsafe .Pointer (uintptr (val >> riscv64CntBits << 3 )))
68
+ }
57
69
return (* lfnode )(unsafe .Pointer (uintptr (val >> cntBits << 3 )))
58
70
}
You can’t perform that action at this time.
0 commit comments