diff --git a/src/gopheros/kernel/goruntime/bootstrap.go b/src/gopheros/kernel/goruntime/bootstrap.go index e51fedc..4bdd5bd 100644 --- a/src/gopheros/kernel/goruntime/bootstrap.go +++ b/src/gopheros/kernel/goruntime/bootstrap.go @@ -27,27 +27,6 @@ var ( prngSeed = 0xdeadc0de ) -//go:linkname algInit runtime.alginit -func algInit() - -//go:linkname modulesInit runtime.modulesinit -func modulesInit() - -//go:linkname typeLinksInit runtime.typelinksinit -func typeLinksInit() - -//go:linkname itabsInit runtime.itabsinit -func itabsInit() - -//go:linkname mallocInit runtime.mallocinit -func mallocInit() - -//go:linkname mSysStatInc runtime.mSysStatInc -func mSysStatInc(*uint64, uintptr) - -//go:linkname procResize runtime.procresize -func procResize(int32) uintptr - // initGoPackages is an alias to main.init which recursively calls the init() // methods in all imported packages. Unless this function is called, things like // package errors will not be properly initialized causing various problems when @@ -184,7 +163,7 @@ func getRandomData(r []byte) { func Init() *kernel.Error { mallocInitFn() algInitFn() // setup hash implementation for map keys - modulesInitFn() // provides activeModules + modulesInitFn() // provides activeModules (go 1.8+) typeLinksInitFn() // uses maps, activeModules itabsInitFn() // uses activeModules diff --git a/src/gopheros/kernel/goruntime/bootstrap_go17.go b/src/gopheros/kernel/goruntime/bootstrap_go17.go new file mode 100644 index 0000000..6022c01 --- /dev/null +++ b/src/gopheros/kernel/goruntime/bootstrap_go17.go @@ -0,0 +1,30 @@ +// +build go1.7,!go1.8 + +package goruntime + +import ( + _ "unsafe" // required for go:linkname +) + +//go:linkname algInit runtime.alginit +func algInit() + +//go:linkname typeLinksInit runtime.typelinksinit +func typeLinksInit() + +//go:linkname itabsInit runtime.itabsinit +func itabsInit() + +//go:linkname mallocInit runtime.mallocinit +func mallocInit() + +//go:linkname mSysStatInc runtime.mSysStatInc +func mSysStatInc(*uint64, uintptr) + +//go:linkname procResize runtime.procresize +func procResize(int32) uintptr + +// modulesInit is defined on go1.8 so just declare an empty +// stub for go 1.7 to keep the compiler happy. +func modulesInit() { +} diff --git a/src/gopheros/kernel/goruntime/bootstrap_go18+.go b/src/gopheros/kernel/goruntime/bootstrap_go18+.go new file mode 100644 index 0000000..90eaaf2 --- /dev/null +++ b/src/gopheros/kernel/goruntime/bootstrap_go18+.go @@ -0,0 +1,28 @@ +// +build go1.8 + +package goruntime + +import ( + _ "unsafe" // required for go:linkname +) + +//go:linkname algInit runtime.alginit +func algInit() + +//go:linkname modulesInit runtime.modulesinit +func modulesInit() + +//go:linkname typeLinksInit runtime.typelinksinit +func typeLinksInit() + +//go:linkname itabsInit runtime.itabsinit +func itabsInit() + +//go:linkname mallocInit runtime.mallocinit +func mallocInit() + +//go:linkname mSysStatInc runtime.mSysStatInc +func mSysStatInc(*uint64, uintptr) + +//go:linkname procResize runtime.procresize +func procResize(int32) uintptr