generalize -scheduler=none to support most platforms

Этот коммит содержится в:
Jaden Weiss 2020-02-07 17:17:38 -05:00 коммит произвёл Ayke
родитель 5089d1a5a7
коммит 5d869f6042
12 изменённых файлов: 48 добавлений и 40 удалений

Просмотреть файл

@ -30,20 +30,16 @@ var _sidata [0]byte
//go:extern _edata
var _edata [0]byte
func postinit() {}
// Entry point for Go. Initialize all packages and call main.main().
//go:export main
func main() {
// Initialize .data and .bss sections.
preinit()
// Run initializers of all packages.
initAll()
// Compiler-generated call to main.main().
go callMain()
// Run the scheduler.
scheduler()
// Run program.
run()
}
func preinit() {

Просмотреть файл

@ -13,12 +13,12 @@ import (
type timeUnit int64
func postinit() {}
//go:export Reset_Handler
func main() {
preinit()
initAll()
go callMain()
scheduler()
run()
abort()
}

Просмотреть файл

@ -12,12 +12,12 @@ import (
type timeUnit int64
func postinit() {}
//go:export Reset_Handler
func main() {
preinit()
initAll()
go callMain()
scheduler()
run()
abort()
}

Просмотреть файл

@ -39,9 +39,7 @@ var _ebss [0]byte
//go:export main
func main() {
preinit()
initAll()
postinit()
callMain()
run()
abort()
}

Просмотреть файл

@ -17,12 +17,12 @@ const tickMicros = 1
var timestamp timeUnit
func postinit() {}
//go:export Reset_Handler
func main() {
preinit()
initAll()
go callMain()
scheduler()
run()
arm.SemihostingCall(arm.SemihostingReportException, arm.SemihostingApplicationExit)
abort()
}

Просмотреть файл

@ -31,6 +31,8 @@ var _sidata [0]byte
//go:extern _edata
var _edata [0]byte
func postinit() {}
//go:export main
func main() {
// Zero the PLIC enable bits on startup: they are not zeroed at reset.
@ -51,9 +53,7 @@ func main() {
preinit()
initPeripherals()
initAll()
go callMain()
scheduler()
run()
abort()
}

Просмотреть файл

@ -17,13 +17,13 @@ const tickMicros = 1024 * 32
//go:linkname systemInit SystemInit
func systemInit()
func postinit() {}
//go:export Reset_Handler
func main() {
systemInit()
preinit()
initAll()
go callMain()
scheduler()
run()
abort()
}

Просмотреть файл

@ -4,11 +4,11 @@ package runtime
type timeUnit int64
func postinit() {}
//go:export Reset_Handler
func main() {
preinit()
initAll()
go callMain()
scheduler()
run()
abort()
}

Просмотреть файл

@ -45,17 +45,12 @@ type timespec struct {
const CLOCK_MONOTONIC_RAW = 4
func postinit() {}
// Entry point for Go. Initialize all packages and call main.main().
//go:export main
func main() int {
// Run initializers of all packages.
initAll()
// Compiler-generated call to main.main().
go callMain()
// Run scheduler.
scheduler()
run()
// For libc compatibility.
return 0

Просмотреть файл

@ -18,11 +18,11 @@ type wasiIOVec struct {
//export fd_write
func fd_write(id uint32, iovs *wasiIOVec, iovs_len uint, nwritten *uint) (errno uint)
func postinit() {}
//export _start
func _start() {
initAll()
go callMain()
scheduler()
run()
}
// Using global variables to avoid heap allocation.

Просмотреть файл

@ -10,3 +10,14 @@ func sleep(duration int64) {
addSleepTask(task.Current(), duration)
task.Pause()
}
// run is called by the program entry point to execute the go program.
// With a scheduler, init and the main function are invoked in a goroutine before starting the scheduler.
func run() {
initAll()
postinit()
go func() {
callMain()
}()
scheduler()
}

Просмотреть файл

@ -12,3 +12,11 @@ func sleep(duration int64) {
func getSystemStackPointer() uintptr {
return getCurrentStackPointer()
}
// run is called by the program entry point to execute the go program.
// With the "none" scheduler, init and the main function are invoked directly.
func run() {
initAll()
postinit()
callMain()
}