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