Source file
src/runtime/os_wasm.go
1
2
3
4
5 package runtime
6
7 import (
8 "internal/runtime/atomic"
9 "unsafe"
10 )
11
12 func osinit() {
13
14 physPageSize = 64 * 1024
15 initBloc()
16 blocMax = uintptr(currentMemory()) * physPageSize
17 ncpu = 1
18 getg().m.procid = 2
19 }
20
21 const _SIGSEGV = 0xb
22
23 func sigpanic() {
24 gp := getg()
25 if !canpanic() {
26 throw("unexpected signal during runtime execution")
27 }
28
29
30 gp.sig = _SIGSEGV
31 panicmem()
32 }
33
34
35
36 func exitThread(wait *atomic.Uint32)
37
38 type mOS struct{}
39
40 func osyield()
41
42
43 func osyield_no_g() {
44 osyield()
45 }
46
47 type sigset struct{}
48
49
50
51 func mpreinit(mp *m) {
52 mp.gsignal = malg(32 * 1024)
53 mp.gsignal.m = mp
54 }
55
56
57 func usleep_no_g(usec uint32) {
58 usleep(usec)
59 }
60
61
62 func sigsave(p *sigset) {
63 }
64
65
66 func msigrestore(sigmask sigset) {
67 }
68
69
70
71 func clearSignalHandlers() {
72 }
73
74
75 func sigblock(exiting bool) {
76 }
77
78
79
80 func minit() {
81 }
82
83
84 func unminit() {
85 }
86
87
88
89 func mdestroy(mp *m) {
90 }
91
92
93 const _NSIG = 0
94
95 func signame(sig uint32) string {
96 return ""
97 }
98
99 func crash() {
100 abort()
101 }
102
103 func initsig(preinit bool) {
104 }
105
106
107
108
109 func newosproc(mp *m) {
110 throw("newosproc: not implemented")
111 }
112
113
114
115
116 func os_sigpipe() {}
117
118
119 func syscall_now() (sec int64, nsec int32) {
120 sec, nsec, _ = time_now()
121 return
122 }
123
124
125 func cputicks() int64 {
126
127 return nanotime()
128 }
129
130
131 type gsignalStack struct{}
132
133 const preemptMSupported = false
134
135 func preemptM(mp *m) {
136
137 }
138
139
140
141 func getfp() uintptr { return 0 }
142
143 func setProcessCPUProfiler(hz int32) {}
144 func setThreadCPUProfiler(hz int32) {}
145 func sigdisable(uint32) {}
146 func sigenable(uint32) {}
147 func sigignore(uint32) {}
148
149
150 func open(name *byte, mode, perm int32) int32 { panic("not implemented") }
151 func closefd(fd int32) int32 { panic("not implemented") }
152 func read(fd int32, p unsafe.Pointer, n int32) int32 { panic("not implemented") }
153
View as plain text