Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 1 | // Copyright 2011 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package runtime |
| 6 | |
Michael Matloob | 67faca7 | 2015-11-02 14:09:24 -0500 | [diff] [blame] | 7 | import ( |
Cherry Mui | 140cd7c | 2021-05-13 18:07:57 -0400 | [diff] [blame] | 8 | "internal/abi" |
Michael Matloob | 67faca7 | 2015-11-02 14:09:24 -0500 | [diff] [blame] | 9 | "runtime/internal/atomic" |
| 10 | "unsafe" |
| 11 | ) |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 12 | |
Brad Fitzpatrick | 2dc6800 | 2016-05-06 08:26:37 -0700 | [diff] [blame] | 13 | type mOS struct { |
| 14 | waitsemacount uint32 |
| 15 | } |
| 16 | |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 17 | const ( |
Matthew Dempsky | 95ab84a | 2015-02-16 18:18:13 +0900 | [diff] [blame] | 18 | _ESRCH = 3 |
Matthew Dempsky | 95ab84a | 2015-02-16 18:18:13 +0900 | [diff] [blame] | 19 | _EWOULDBLOCK = _EAGAIN |
| 20 | _ENOTSUP = 91 |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 21 | |
| 22 | // From OpenBSD's sys/time.h |
Matthew Dempsky | 95ab84a | 2015-02-16 18:18:13 +0900 | [diff] [blame] | 23 | _CLOCK_REALTIME = 0 |
| 24 | _CLOCK_VIRTUAL = 1 |
| 25 | _CLOCK_PROF = 2 |
| 26 | _CLOCK_MONOTONIC = 3 |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 27 | ) |
| 28 | |
Elias Naur | a7383fc | 2015-11-17 11:41:06 +0100 | [diff] [blame] | 29 | type sigset uint32 |
| 30 | |
Ian Lance Taylor | ab552aa | 2016-09-23 17:54:51 -0700 | [diff] [blame] | 31 | var sigset_all = ^sigset(0) |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 32 | |
| 33 | // From OpenBSD's <sys/sysctl.h> |
| 34 | const ( |
Austin Clements | 955cc07 | 2018-06-29 14:56:48 -0400 | [diff] [blame] | 35 | _CTL_KERN = 1 |
| 36 | _KERN_OSREV = 3 |
| 37 | |
Tobias Klauser | c55eeeb7 | 2019-02-08 09:25:05 +0100 | [diff] [blame] | 38 | _CTL_HW = 6 |
| 39 | _HW_NCPU = 3 |
| 40 | _HW_PAGESIZE = 7 |
| 41 | _HW_NCPUONLINE = 25 |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 42 | ) |
| 43 | |
Austin Clements | 9daa35e | 2018-06-29 16:09:01 -0400 | [diff] [blame] | 44 | func sysctlInt(mib []uint32) (int32, bool) { |
| 45 | var out int32 |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 46 | nout := unsafe.Sizeof(out) |
Austin Clements | 9daa35e | 2018-06-29 16:09:01 -0400 | [diff] [blame] | 47 | ret := sysctl(&mib[0], uint32(len(mib)), (*byte)(unsafe.Pointer(&out)), &nout, nil, 0) |
| 48 | if ret < 0 { |
| 49 | return 0, false |
| 50 | } |
| 51 | return out, true |
| 52 | } |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 53 | |
Joel Sing | cd54ef1 | 2022-08-05 23:39:55 +1000 | [diff] [blame] | 54 | func sysctlUint64(mib []uint32) (uint64, bool) { |
| 55 | var out uint64 |
| 56 | nout := unsafe.Sizeof(out) |
| 57 | ret := sysctl(&mib[0], uint32(len(mib)), (*byte)(unsafe.Pointer(&out)), &nout, nil, 0) |
| 58 | if ret < 0 { |
| 59 | return 0, false |
| 60 | } |
| 61 | return out, true |
| 62 | } |
| 63 | |
| 64 | //go:linkname internal_cpu_sysctlUint64 internal/cpu.sysctlUint64 |
| 65 | func internal_cpu_sysctlUint64(mib []uint32) (uint64, bool) { |
| 66 | return sysctlUint64(mib) |
| 67 | } |
| 68 | |
Austin Clements | 9daa35e | 2018-06-29 16:09:01 -0400 | [diff] [blame] | 69 | func getncpu() int32 { |
Tobias Klauser | c55eeeb7 | 2019-02-08 09:25:05 +0100 | [diff] [blame] | 70 | // Try hw.ncpuonline first because hw.ncpu would report a number twice as |
| 71 | // high as the actual CPUs running on OpenBSD 6.4 with hyperthreading |
| 72 | // disabled (hw.smt=0). See https://golang.org/issue/30127 |
| 73 | if n, ok := sysctlInt([]uint32{_CTL_HW, _HW_NCPUONLINE}); ok { |
| 74 | return int32(n) |
| 75 | } |
| 76 | if n, ok := sysctlInt([]uint32{_CTL_HW, _HW_NCPU}); ok { |
| 77 | return int32(n) |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 78 | } |
| 79 | return 1 |
| 80 | } |
| 81 | |
Austin Clements | 276a52d | 2016-07-18 21:40:02 -0400 | [diff] [blame] | 82 | func getPageSize() uintptr { |
Austin Clements | 9daa35e | 2018-06-29 16:09:01 -0400 | [diff] [blame] | 83 | if ps, ok := sysctlInt([]uint32{_CTL_HW, _HW_PAGESIZE}); ok { |
| 84 | return uintptr(ps) |
Austin Clements | 276a52d | 2016-07-18 21:40:02 -0400 | [diff] [blame] | 85 | } |
| 86 | return 0 |
| 87 | } |
| 88 | |
Austin Clements | 9daa35e | 2018-06-29 16:09:01 -0400 | [diff] [blame] | 89 | func getOSRev() int { |
| 90 | if osrev, ok := sysctlInt([]uint32{_CTL_KERN, _KERN_OSREV}); ok { |
| 91 | return int(osrev) |
Austin Clements | 955cc07 | 2018-06-29 14:56:48 -0400 | [diff] [blame] | 92 | } |
| 93 | return 0 |
| 94 | } |
| 95 | |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 96 | //go:nosplit |
Matthew Dempsky | ec9aae7 | 2015-10-21 18:36:05 -0700 | [diff] [blame] | 97 | func semacreate(mp *m) { |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | //go:nosplit |
| 101 | func semasleep(ns int64) int32 { |
Michael Pratt | 5999a28 | 2022-07-20 11:43:30 -0400 | [diff] [blame] | 102 | gp := getg() |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 103 | |
| 104 | // Compute sleep deadline. |
| 105 | var tsp *timespec |
| 106 | if ns >= 0 { |
| 107 | var ts timespec |
Ian Lance Taylor | 0a7bc8f | 2019-03-13 18:56:37 -0700 | [diff] [blame] | 108 | ts.setNsec(ns + nanotime()) |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 109 | tsp = &ts |
| 110 | } |
| 111 | |
| 112 | for { |
Michael Pratt | 5999a28 | 2022-07-20 11:43:30 -0400 | [diff] [blame] | 113 | v := atomic.Load(&gp.m.waitsemacount) |
Matthew Dempsky | 9f926e8 | 2015-02-23 17:05:30 +0900 | [diff] [blame] | 114 | if v > 0 { |
Michael Pratt | 5999a28 | 2022-07-20 11:43:30 -0400 | [diff] [blame] | 115 | if atomic.Cas(&gp.m.waitsemacount, v, v-1) { |
Matthew Dempsky | 9f926e8 | 2015-02-23 17:05:30 +0900 | [diff] [blame] | 116 | return 0 // semaphore acquired |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 117 | } |
Matthew Dempsky | 9f926e8 | 2015-02-23 17:05:30 +0900 | [diff] [blame] | 118 | continue |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 119 | } |
| 120 | |
Matthew Dempsky | 9f926e8 | 2015-02-23 17:05:30 +0900 | [diff] [blame] | 121 | // Sleep until woken by semawakeup or timeout; or abort if waitsemacount != 0. |
| 122 | // |
| 123 | // From OpenBSD's __thrsleep(2) manual: |
| 124 | // "The abort argument, if not NULL, points to an int that will |
Brad Fitzpatrick | 5fea2cc | 2016-03-01 23:21:55 +0000 | [diff] [blame] | 125 | // be examined [...] immediately before blocking. If that int |
Matthew Dempsky | 9f926e8 | 2015-02-23 17:05:30 +0900 | [diff] [blame] | 126 | // is non-zero then __thrsleep() will immediately return EINTR |
| 127 | // without blocking." |
Michael Pratt | 5999a28 | 2022-07-20 11:43:30 -0400 | [diff] [blame] | 128 | ret := thrsleep(uintptr(unsafe.Pointer(&gp.m.waitsemacount)), _CLOCK_MONOTONIC, tsp, 0, &gp.m.waitsemacount) |
Matthew Dempsky | 95ab84a | 2015-02-16 18:18:13 +0900 | [diff] [blame] | 129 | if ret == _EWOULDBLOCK { |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 130 | return -1 |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | //go:nosplit |
| 136 | func semawakeup(mp *m) { |
Michael Matloob | 67faca7 | 2015-11-02 14:09:24 -0500 | [diff] [blame] | 137 | atomic.Xadd(&mp.waitsemacount, 1) |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 138 | ret := thrwakeup(uintptr(unsafe.Pointer(&mp.waitsemacount)), 1) |
Matthew Dempsky | 95ab84a | 2015-02-16 18:18:13 +0900 | [diff] [blame] | 139 | if ret != 0 && ret != _ESRCH { |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 140 | // semawakeup can be called on signal stack. |
| 141 | systemstack(func() { |
| 142 | print("thrwakeup addr=", &mp.waitsemacount, " sem=", mp.waitsemacount, " ret=", ret, "\n") |
| 143 | }) |
| 144 | } |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 145 | } |
| 146 | |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 147 | func osinit() { |
| 148 | ncpu = getncpu() |
Austin Clements | 276a52d | 2016-07-18 21:40:02 -0400 | [diff] [blame] | 149 | physPageSize = getPageSize() |
Austin Clements | 955cc07 | 2018-06-29 14:56:48 -0400 | [diff] [blame] | 150 | haveMapStack = getOSRev() >= 201805 // OpenBSD 6.3 |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 151 | } |
| 152 | |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 153 | var urandom_dev = []byte("/dev/urandom\x00") |
| 154 | |
| 155 | //go:nosplit |
Keith Randall | 6820be2 | 2014-12-09 14:40:40 -0800 | [diff] [blame] | 156 | func getRandomData(r []byte) { |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 157 | fd := open(&urandom_dev[0], 0 /* O_RDONLY */, 0) |
Keith Randall | 6820be2 | 2014-12-09 14:40:40 -0800 | [diff] [blame] | 158 | n := read(fd, unsafe.Pointer(&r[0]), int32(len(r))) |
David Crawshaw | cea272d | 2015-04-13 19:37:04 -0400 | [diff] [blame] | 159 | closefd(fd) |
Keith Randall | 6820be2 | 2014-12-09 14:40:40 -0800 | [diff] [blame] | 160 | extendRandom(r, int(n)) |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | func goenvs() { |
| 164 | goenvs_unix() |
| 165 | } |
| 166 | |
| 167 | // Called to initialize a new m (including the bootstrap m). |
| 168 | // Called on the parent thread (main thread in case of bootstrap), can allocate memory. |
| 169 | func mpreinit(mp *m) { |
Joel Sing | 55f8d56 | 2020-08-25 18:04:47 +1000 | [diff] [blame] | 170 | gsignalSize := int32(32 * 1024) |
| 171 | if GOARCH == "mips64" { |
| 172 | gsignalSize = int32(64 * 1024) |
| 173 | } |
| 174 | mp.gsignal = malg(gsignalSize) |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 175 | mp.gsignal.m = mp |
| 176 | } |
| 177 | |
| 178 | // Called to initialize a new m (including the bootstrap m). |
| 179 | // Called on the new thread, can not allocate memory. |
| 180 | func minit() { |
Austin Clements | 8714e39 | 2019-10-14 17:05:56 -0400 | [diff] [blame] | 181 | getg().m.procid = uint64(getthrid()) |
Ian Lance Taylor | ac24388 | 2016-09-26 11:14:41 -0700 | [diff] [blame] | 182 | minitSignals() |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | // Called from dropm to undo the effect of an minit. |
Russ Cox | 9839668 | 2022-01-30 20:13:43 -0500 | [diff] [blame] | 186 | // |
Russ Cox | f8e6418 | 2015-11-13 16:21:01 -0500 | [diff] [blame] | 187 | //go:nosplit |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 188 | func unminit() { |
Ian Lance Taylor | e2e11f0 | 2016-09-26 11:35:55 -0700 | [diff] [blame] | 189 | unminitSignals() |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 190 | } |
| 191 | |
Jason A. Donenfeld | dbab079 | 2021-01-15 13:01:37 +0100 | [diff] [blame] | 192 | // Called from exitm, but not from drop, to undo the effect of thread-owned |
| 193 | // resources in minit, semacreate, or elsewhere. Do not take locks after calling this. |
| 194 | func mdestroy(mp *m) { |
| 195 | } |
| 196 | |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 197 | func sigtramp() |
| 198 | |
| 199 | type sigactiont struct { |
| 200 | sa_sigaction uintptr |
| 201 | sa_mask uint32 |
| 202 | sa_flags int32 |
| 203 | } |
| 204 | |
Ian Lance Taylor | 21b4f23 | 2015-12-26 09:51:59 -0800 | [diff] [blame] | 205 | //go:nosplit |
| 206 | //go:nowritebarrierrec |
Ian Lance Taylor | eb268cb | 2016-09-27 22:24:51 -0700 | [diff] [blame] | 207 | func setsig(i uint32, fn uintptr) { |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 208 | var sa sigactiont |
Ian Lance Taylor | eb268cb | 2016-09-27 22:24:51 -0700 | [diff] [blame] | 209 | sa.sa_flags = _SA_SIGINFO | _SA_ONSTACK | _SA_RESTART |
Elias Naur | a7383fc | 2015-11-17 11:41:06 +0100 | [diff] [blame] | 210 | sa.sa_mask = uint32(sigset_all) |
Cherry Mui | 626e89c | 2021-05-21 13:37:19 -0400 | [diff] [blame] | 211 | if fn == abi.FuncPCABIInternal(sighandler) { // abi.FuncPCABIInternal(sighandler) matches the callers in signal_unix.go |
Cherry Mui | 140cd7c | 2021-05-13 18:07:57 -0400 | [diff] [blame] | 212 | fn = abi.FuncPCABI0(sigtramp) |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 213 | } |
| 214 | sa.sa_sigaction = fn |
| 215 | sigaction(i, &sa, nil) |
| 216 | } |
| 217 | |
Ian Lance Taylor | 21b4f23 | 2015-12-26 09:51:59 -0800 | [diff] [blame] | 218 | //go:nosplit |
| 219 | //go:nowritebarrierrec |
Ian Lance Taylor | eb268cb | 2016-09-27 22:24:51 -0700 | [diff] [blame] | 220 | func setsigstack(i uint32) { |
Keith Randall | b2a950b | 2014-12-27 20:58:00 -0800 | [diff] [blame] | 221 | throw("setsigstack") |
Austin Clements | 675eb72 | 2014-12-19 16:16:17 -0500 | [diff] [blame] | 222 | } |
| 223 | |
Ian Lance Taylor | 21b4f23 | 2015-12-26 09:51:59 -0800 | [diff] [blame] | 224 | //go:nosplit |
| 225 | //go:nowritebarrierrec |
Ian Lance Taylor | eb268cb | 2016-09-27 22:24:51 -0700 | [diff] [blame] | 226 | func getsig(i uint32) uintptr { |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 227 | var sa sigactiont |
| 228 | sigaction(i, nil, &sa) |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 229 | return sa.sa_sigaction |
| 230 | } |
| 231 | |
cui fliter | 069d1fc | 2022-10-03 01:32:11 +0000 | [diff] [blame] | 232 | // setSignalstackSP sets the ss_sp field of a stackt. |
Russ Cox | 9839668 | 2022-01-30 20:13:43 -0500 | [diff] [blame] | 233 | // |
Russ Cox | f8e6418 | 2015-11-13 16:21:01 -0500 | [diff] [blame] | 234 | //go:nosplit |
Ian Lance Taylor | d15295c | 2016-09-25 13:38:54 -0700 | [diff] [blame] | 235 | func setSignalstackSP(s *stackt, sp uintptr) { |
| 236 | s.ss_sp = sp |
Joel Sing | ba603c3 | 2014-11-14 13:01:12 +1100 | [diff] [blame] | 237 | } |
| 238 | |
Ian Lance Taylor | 21b4f23 | 2015-12-26 09:51:59 -0800 | [diff] [blame] | 239 | //go:nosplit |
| 240 | //go:nowritebarrierrec |
Ian Lance Taylor | fdc1671 | 2016-09-27 13:42:28 -0700 | [diff] [blame] | 241 | func sigaddset(mask *sigset, i int) { |
| 242 | *mask |= 1 << (uint32(i) - 1) |
Ian Lance Taylor | 872b168 | 2015-07-21 22:34:48 -0700 | [diff] [blame] | 243 | } |
Ian Lance Taylor | c273503 | 2016-09-25 21:33:27 -0700 | [diff] [blame] | 244 | |
Ian Lance Taylor | ac24388 | 2016-09-26 11:14:41 -0700 | [diff] [blame] | 245 | func sigdelset(mask *sigset, i int) { |
| 246 | *mask &^= 1 << (uint32(i) - 1) |
| 247 | } |
| 248 | |
Clément Chigot | 3aacfce | 2019-03-25 10:34:57 +0100 | [diff] [blame] | 249 | //go:nosplit |
Ian Lance Taylor | c273503 | 2016-09-25 21:33:27 -0700 | [diff] [blame] | 250 | func (c *sigctxt) fixsigcode(sig uint32) { |
| 251 | } |
Austin Clements | 955cc07 | 2018-06-29 14:56:48 -0400 | [diff] [blame] | 252 | |
Rhys Hiltner | f9e90f7 | 2021-08-13 08:51:46 -0700 | [diff] [blame] | 253 | func setProcessCPUProfiler(hz int32) { |
| 254 | setProcessCPUProfilerTimer(hz) |
| 255 | } |
| 256 | |
| 257 | func setThreadCPUProfiler(hz int32) { |
| 258 | setThreadCPUProfilerHz(hz) |
| 259 | } |
| 260 | |
| 261 | //go:nosplit |
| 262 | func validSIGPROF(mp *m, c *sigctxt) bool { |
| 263 | return true |
| 264 | } |
| 265 | |
Austin Clements | 955cc07 | 2018-06-29 14:56:48 -0400 | [diff] [blame] | 266 | var haveMapStack = false |
| 267 | |
| 268 | func osStackAlloc(s *mspan) { |
| 269 | // OpenBSD 6.4+ requires that stacks be mapped with MAP_STACK. |
| 270 | // It will check this on entry to system calls, traps, and |
| 271 | // when switching to the alternate system stack. |
| 272 | // |
| 273 | // This function is called before s is used for any data, so |
| 274 | // it's safe to simply re-map it. |
| 275 | osStackRemap(s, _MAP_STACK) |
| 276 | } |
| 277 | |
| 278 | func osStackFree(s *mspan) { |
| 279 | // Undo MAP_STACK. |
| 280 | osStackRemap(s, 0) |
| 281 | } |
| 282 | |
| 283 | func osStackRemap(s *mspan, flags int32) { |
| 284 | if !haveMapStack { |
| 285 | // OpenBSD prior to 6.3 did not have MAP_STACK and so |
| 286 | // the following mmap will fail. But it also didn't |
| 287 | // require MAP_STACK (obviously), so there's no need |
| 288 | // to do the mmap. |
| 289 | return |
| 290 | } |
| 291 | a, err := mmap(unsafe.Pointer(s.base()), s.npages*pageSize, _PROT_READ|_PROT_WRITE, _MAP_PRIVATE|_MAP_ANON|_MAP_FIXED|flags, -1, 0) |
| 292 | if err != 0 || uintptr(a) != s.base() { |
| 293 | print("runtime: remapping stack memory ", hex(s.base()), " ", s.npages*pageSize, " a=", a, " err=", err, "\n") |
| 294 | throw("remapping stack memory failed") |
| 295 | } |
| 296 | } |
Austin Clements | 8714e39 | 2019-10-14 17:05:56 -0400 | [diff] [blame] | 297 | |
Ian Lance Taylor | 9699086 | 2020-07-06 14:23:26 -0700 | [diff] [blame] | 298 | //go:nosplit |
Austin Clements | 8714e39 | 2019-10-14 17:05:56 -0400 | [diff] [blame] | 299 | func raise(sig uint32) { |
| 300 | thrkill(getthrid(), int(sig)) |
| 301 | } |
| 302 | |
| 303 | func signalM(mp *m, sig int) { |
| 304 | thrkill(int32(mp.procid), sig) |
| 305 | } |
Michael Pratt | 0a5fae2 | 2022-02-04 17:15:28 -0500 | [diff] [blame] | 306 | |
| 307 | // sigPerThreadSyscall is only used on linux, so we assign a bogus signal |
| 308 | // number. |
| 309 | const sigPerThreadSyscall = 1 << 31 |
| 310 | |
| 311 | //go:nosplit |
| 312 | func runPerThreadSyscall() { |
| 313 | throw("runPerThreadSyscall only valid on linux") |
| 314 | } |