diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2016-05-06 08:26:37 -0700 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-05-06 16:03:25 +0000 |
commit | 2dc680007e35f4cb87527582eb73a653392aa8c3 (patch) | |
tree | 0be1196d2995b3e0964abb6fe6babd8211b24028 /src/runtime/os_plan9.go | |
parent | bf151cc2aa4094b4633a7e5f07a34227d58231fe (diff) | |
download | go-2dc680007e35f4cb87527582eb73a653392aa8c3.tar.gz go-2dc680007e35f4cb87527582eb73a653392aa8c3.zip |
runtime: merge the last four os-vs-os1 files together
Change-Id: Ib0ba691c4657fe18a4659753e70d97c623cb9c1d
Reviewed-on: https://go-review.googlesource.com/22850
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/os_plan9.go')
-rw-r--r-- | src/runtime/os_plan9.go | 145 |
1 files changed, 0 insertions, 145 deletions
diff --git a/src/runtime/os_plan9.go b/src/runtime/os_plan9.go index 5c43a3bd85..47bf8fc20d 100644 --- a/src/runtime/os_plan9.go +++ b/src/runtime/os_plan9.go @@ -3,148 +3,3 @@ // license that can be found in the LICENSE file. package runtime - -import "unsafe" - -type mOS struct { - waitsemacount uint32 - notesig *int8 - errstr *byte -} - -func closefd(fd int32) int32 - -//go:noescape -func open(name *byte, mode, perm int32) int32 - -//go:noescape -func pread(fd int32, buf unsafe.Pointer, nbytes int32, offset int64) int32 - -//go:noescape -func pwrite(fd int32, buf unsafe.Pointer, nbytes int32, offset int64) int32 - -func seek(fd int32, offset int64, whence int32) int64 - -//go:noescape -func exits(msg *byte) - -//go:noescape -func brk_(addr unsafe.Pointer) int32 - -func sleep(ms int32) int32 - -func rfork(flags int32) int32 - -//go:noescape -func plan9_semacquire(addr *uint32, block int32) int32 - -//go:noescape -func plan9_tsemacquire(addr *uint32, ms int32) int32 - -//go:noescape -func plan9_semrelease(addr *uint32, count int32) int32 - -//go:noescape -func notify(fn unsafe.Pointer) int32 - -func noted(mode int32) int32 - -//go:noescape -func nsec(*int64) int64 - -//go:noescape -func sigtramp(ureg, msg unsafe.Pointer) - -func setfpmasks() - -//go:noescape -func tstart_plan9(newm *m) - -func errstr() string - -type _Plink uintptr - -//go:linkname os_sigpipe os.sigpipe -func os_sigpipe() { - throw("too many writes on closed pipe") -} - -func sigpanic() { - g := getg() - if !canpanic(g) { - throw("unexpected signal during runtime execution") - } - - note := gostringnocopy((*byte)(unsafe.Pointer(g.m.notesig))) - switch g.sig { - case _SIGRFAULT, _SIGWFAULT: - i := index(note, "addr=") - if i >= 0 { - i += 5 - } else if i = index(note, "va="); i >= 0 { - i += 3 - } else { - panicmem() - } - addr := note[i:] - g.sigcode1 = uintptr(atolwhex(addr)) - if g.sigcode1 < 0x1000 || g.paniconfault { - panicmem() - } - print("unexpected fault address ", hex(g.sigcode1), "\n") - throw("fault") - case _SIGTRAP: - if g.paniconfault { - panicmem() - } - throw(note) - case _SIGINTDIV: - panicdivide() - case _SIGFLOAT: - panicfloat() - default: - panic(errorString(note)) - } -} - -func atolwhex(p string) int64 { - for hasprefix(p, " ") || hasprefix(p, "\t") { - p = p[1:] - } - neg := false - if hasprefix(p, "-") || hasprefix(p, "+") { - neg = p[0] == '-' - p = p[1:] - for hasprefix(p, " ") || hasprefix(p, "\t") { - p = p[1:] - } - } - var n int64 - switch { - case hasprefix(p, "0x"), hasprefix(p, "0X"): - p = p[2:] - for ; len(p) > 0; p = p[1:] { - if '0' <= p[0] && p[0] <= '9' { - n = n*16 + int64(p[0]-'0') - } else if 'a' <= p[0] && p[0] <= 'f' { - n = n*16 + int64(p[0]-'a'+10) - } else if 'A' <= p[0] && p[0] <= 'F' { - n = n*16 + int64(p[0]-'A'+10) - } else { - break - } - } - case hasprefix(p, "0"): - for ; len(p) > 0 && '0' <= p[0] && p[0] <= '7'; p = p[1:] { - n = n*8 + int64(p[0]-'0') - } - default: - for ; len(p) > 0 && '0' <= p[0] && p[0] <= '9'; p = p[1:] { - n = n*10 + int64(p[0]-'0') - } - } - if neg { - n = -n - } - return n -} |