Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harvey port of golang #2

Open
wants to merge 7 commits into
base: harveyport
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: go

go:
- 1.8

env:
global:
- GOROOT_BOOTSTRAP="/home/travis/.gimme/versions/go1.8.linux.amd64"

before_install:
- echo "no"
install:
- echo "no"

before_script:
- cd $TRAVIS_BUILD_DIR/src

script:
- GOOS=harvey GOARCH=amd64 ./make.bash
2 changes: 2 additions & 0 deletions src/cmd/dist/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ var okgoos = []string{
"netbsd",
"openbsd",
"plan9",
"harvey",
"windows",
}

Expand Down Expand Up @@ -1127,6 +1128,7 @@ var cgoEnabled = map[string]bool{
"plan9/386": false,
"plan9/amd64": false,
"plan9/arm": false,
"harvey/amd64": false,
"solaris/amd64": true,
"windows/386": true,
"windows/amd64": true,
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/objabi/head.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (h *HeadType) Set(s string) error {
*h = Hdragonfly
case "freebsd":
*h = Hfreebsd
case "linux", "android":
case "linux", "android", "harvey":
*h = Hlinux
case "nacl":
*h = Hnacl
Expand Down
9 changes: 9 additions & 0 deletions src/go/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,9 @@ func (ctxt *Context) match(name string, allTags map[string]bool) bool {
if ctxt.GOOS == "android" && name == "linux" {
return true
}
if ctxt.GOOS == "harvey" && name == "plan9" {
return true
}

// other tags
for _, tag := range ctxt.BuildTags {
Expand Down Expand Up @@ -1555,6 +1558,9 @@ func (ctxt *Context) goodOSArchFile(name string, allTags map[string]bool) bool {
if ctxt.GOOS == "android" && l[n-2] == "linux" {
return true
}
if ctxt.GOOS == "harvey" && l[n-2] == "plan9" {
return true
}
return l[n-2] == ctxt.GOOS
}
if n >= 1 && knownOS[l[n-1]] {
Expand All @@ -1564,6 +1570,9 @@ func (ctxt *Context) goodOSArchFile(name string, allTags map[string]bool) bool {
if ctxt.GOOS == "android" && l[n-1] == "linux" {
return true
}
if ctxt.GOOS == "harvey" && l[n-1] == "plan9" {
return true
}
return l[n-1] == ctxt.GOOS
}
if n >= 1 && knownArch[l[n-1]] {
Expand Down
2 changes: 1 addition & 1 deletion src/go/build/syslist.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

package build

const goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows zos "
const goosList = "android darwin dragonfly freebsd harvey linux nacl netbsd openbsd plan9 solaris windows zos "
const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64 "
70 changes: 70 additions & 0 deletions src/runtime/defs_harvey_amd64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package runtime

const _PAGESIZE = 0x1000

type ureg struct {
ax uint64
bx uint64
cx uint64
dx uint64
si uint64
di uint64
bp uint64
r8 uint64
r9 uint64
r10 uint64
r11 uint64
r12 uint64
r13 uint64
r14 uint64
r15 uint64

_type uint64
error uint64 /* error code (or zero) */
ip uint64 /* pc */
cs uint64 /* old context */
flags uint64 /* old flags */
sp uint64 /* sp */
ss uint64 /* old stack segment */
}

type sigctxt struct {
u *ureg
}

//go:nosplit
//go:nowritebarrierrec
func (c *sigctxt) pc() uintptr { return uintptr(c.u.ip) }

func (c *sigctxt) sp() uintptr { return uintptr(c.u.sp) }
func (c *sigctxt) lr() uintptr { return uintptr(0) }

func (c *sigctxt) setpc(x uintptr) { c.u.ip = uint64(x) }
func (c *sigctxt) setsp(x uintptr) { c.u.sp = uint64(x) }
func (c *sigctxt) setlr(x uintptr) {}

func (c *sigctxt) savelr(x uintptr) {}

func dumpregs(u *ureg) {
print("ax ", hex(u.ax), "\n")
print("bx ", hex(u.bx), "\n")
print("cx ", hex(u.cx), "\n")
print("dx ", hex(u.dx), "\n")
print("di ", hex(u.di), "\n")
print("si ", hex(u.si), "\n")
print("bp ", hex(u.bp), "\n")
print("sp ", hex(u.sp), "\n")
print("r8 ", hex(u.r8), "\n")
print("r9 ", hex(u.r9), "\n")
print("r10 ", hex(u.r10), "\n")
print("r11 ", hex(u.r11), "\n")
print("r12 ", hex(u.r12), "\n")
print("r13 ", hex(u.r13), "\n")
print("r14 ", hex(u.r14), "\n")
print("r15 ", hex(u.r15), "\n")
print("ip ", hex(u.ip), "\n")
print("flags ", hex(u.flags), "\n")
print("cs ", hex(u.cs), "\n")
}

func sigpanictramp() {}
2 changes: 2 additions & 0 deletions src/runtime/defs_plan9_amd64.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !harvey

package runtime

const _PAGESIZE = 0x1000
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/internal/sys/gengoos.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func main() {
if target == "linux" {
fmt.Fprintf(&buf, "// +build !android\n\n") // must explicitly exclude android for linux
}
if target == "plan9" {
fmt.Fprintf(&buf, "// +build !harvey\n\n") // must explicitly exclude android for linux
}
fmt.Fprintf(&buf, "package sys\n\n")
fmt.Fprintf(&buf, "const GOOS = `%s`\n\n", target)
for _, goos := range gooses {
Expand Down
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_android.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const GoosAndroid = 1
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
Expand Down
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const GoosAndroid = 0
const GoosDarwin = 1
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
Expand Down
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_dragonfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 1
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
Expand Down
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 1
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
Expand Down
18 changes: 18 additions & 0 deletions src/runtime/internal/sys/zgoos_harvey.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// generated by gengoos.go using 'go generate'

package sys

const GOOS = `harvey`

const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 1
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
const GoosOpenbsd = 0
const GoosPlan9 = 0
const GoosSolaris = 0
const GoosWindows = 0
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 1
const GoosNacl = 0
const GoosNetbsd = 0
Expand Down
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_nacl.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 1
const GoosNetbsd = 0
Expand Down
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_netbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 1
Expand Down
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/internal/sys/zgoos_plan9.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// generated by gengoos.go using 'go generate'

// +build !harvey

package sys

const GOOS = `plan9`
Expand All @@ -8,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
Expand Down
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
Expand Down
1 change: 1 addition & 0 deletions src/runtime/internal/sys/zgoos_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosHarvey = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
Expand Down
Loading