UEFI: add support for tasks scheduler and make it default (#5553)

* add support for UEFI time and UEFI events; fix STOP \n -> \r\n conversion

* make it so both scheduler=none and scheduler=tasks works

* address pr comments
  - Renamed/shared the amd64 Win64 ABI task stack Go file for both Windows and UEFI.
  - Deleted the duplicate UEFI task stack Go file and old Windows-suffixed Go file.
  - Added task_stack_amd64_windows.S unconditionally to targets/uefi-amd64.json.
  - Removed the UEFI ExtraFiles() special case from compileopts/config.go.
  - Added a scheduler.none tinygo_task_exit stub.
  - Removed the custom UEFI sleep override so normal scheduler sleep queue is used.

* revert back to simpler return value for ExtraFiles()

* create uefi specific tasks_none file

* remove unused sleepSchedulerCustom stuff

* add back the uefi tag

* lib: restore macos-minimal-sdk pointer
This commit is contained in:
Matthew Hiles
2026-08-28 13:48:48 -04:00
committed by GitHub
parent f924a9e3ea
commit f6e502e121
6 changed files with 14 additions and 16 deletions
+8
View File
@@ -0,0 +1,8 @@
//go:build scheduler.none && uefi
package task
//go:export tinygo_task_exit
func taskExit() {
runtimePanic("scheduler is disabled")
}
+1 -1
View File
@@ -1,4 +1,4 @@
//go:build scheduler.tasks && amd64 && !windows
//go:build scheduler.tasks && amd64 && !windows && !uefi
package task
@@ -1,9 +1,9 @@
//go:build scheduler.tasks && amd64 && windows
//go:build scheduler.tasks && amd64 && (windows || uefi)
package task
// This is almost the same as task_stack_amd64.go, but with the extra rdi and
// rsi registers saved: Windows has a slightly different calling convention.
// rsi registers saved: Windows and UEFI use the Win64 calling convention.
import "unsafe"
-4
View File
@@ -297,10 +297,6 @@ func sleep(duration int64) {
if duration <= 0 {
return
}
if schedulerSleepCustom(duration) {
return
}
addSleepTask(task.Current(), nanosecondsToTicks(duration))
task.Pause()
}
-7
View File
@@ -1,7 +0,0 @@
//go:build !(scheduler.tasks && uefi)
package runtime
func schedulerSleepCustom(duration int64) bool {
return false
}
+3 -2
View File
@@ -6,7 +6,7 @@
"goos": "linux",
"goarch": "amd64",
"gc": "leaking",
"scheduler": "none",
"scheduler": "tasks",
"linker": "ld.lld",
"linker-flavor": "coff",
"libc": "picolibc",
@@ -35,7 +35,8 @@
"extra-files": [
"src/device/amd64/cpu_amd64.S",
"src/device/uefi/asm_amd64.S",
"src/runtime/asm_amd64_windows.S"
"src/runtime/asm_amd64_windows.S",
"src/internal/task/task_stack_amd64_windows.S"
],
"gdb": ["gdb-multiarch", "gdb"]
}