Richard Musiol | 35ea624 | 2018-03-31 23:14:17 +0200 | [diff] [blame] | 1 | // Copyright 2018 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 | |
| 7 | import ( |
| 8 | "runtime/internal/sys" |
| 9 | "unsafe" |
| 10 | ) |
| 11 | |
| 12 | type m0Stack struct { |
| 13 | _ [8192 * sys.StackGuardMultiplier]byte |
| 14 | } |
| 15 | |
| 16 | var wasmStack m0Stack |
| 17 | |
| 18 | func wasmMove() |
| 19 | |
| 20 | func wasmZero() |
| 21 | |
| 22 | func wasmDiv() |
| 23 | |
| 24 | func wasmTruncS() |
| 25 | func wasmTruncU() |
| 26 | |
| 27 | func wasmExit(code int32) |
| 28 | |
| 29 | // adjust Gobuf as it if executed a call to fn with context ctxt |
| 30 | // and then did an immediate gosave. |
| 31 | func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) { |
| 32 | sp := buf.sp |
| 33 | if sys.RegSize > sys.PtrSize { |
| 34 | sp -= sys.PtrSize |
| 35 | *(*uintptr)(unsafe.Pointer(sp)) = 0 |
| 36 | } |
| 37 | sp -= sys.PtrSize |
| 38 | *(*uintptr)(unsafe.Pointer(sp)) = buf.pc |
| 39 | buf.sp = sp |
| 40 | buf.pc = uintptr(fn) |
| 41 | buf.ctxt = ctxt |
| 42 | } |