diff --git a/src/internal/task/task_none_uefi.go b/src/internal/task/task_none_uefi.go new file mode 100644 index 0000000000..f4e755b84a --- /dev/null +++ b/src/internal/task/task_none_uefi.go @@ -0,0 +1,8 @@ +//go:build scheduler.none && uefi + +package task + +//go:export tinygo_task_exit +func taskExit() { + runtimePanic("scheduler is disabled") +} diff --git a/src/internal/task/task_stack_amd64.go b/src/internal/task/task_stack_amd64.go index d252b1c50d..bfd18b5758 100644 --- a/src/internal/task/task_stack_amd64.go +++ b/src/internal/task/task_stack_amd64.go @@ -1,4 +1,4 @@ -//go:build scheduler.tasks && amd64 && !windows +//go:build scheduler.tasks && amd64 && !windows && !uefi package task diff --git a/src/internal/task/task_stack_amd64_windows.go b/src/internal/task/task_stack_amd64_winabi.go similarity index 94% rename from src/internal/task/task_stack_amd64_windows.go rename to src/internal/task/task_stack_amd64_winabi.go index f174196f35..17d19d7c89 100644 --- a/src/internal/task/task_stack_amd64_windows.go +++ b/src/internal/task/task_stack_amd64_winabi.go @@ -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" diff --git a/src/runtime/scheduler_cooperative.go b/src/runtime/scheduler_cooperative.go index 72d9e175cf..a69247c84e 100644 --- a/src/runtime/scheduler_cooperative.go +++ b/src/runtime/scheduler_cooperative.go @@ -297,10 +297,6 @@ func sleep(duration int64) { if duration <= 0 { return } - if schedulerSleepCustom(duration) { - return - } - addSleepTask(task.Current(), nanosecondsToTicks(duration)) task.Pause() } diff --git a/src/runtime/sleep_custom_default.go b/src/runtime/sleep_custom_default.go deleted file mode 100644 index a32fe1dce3..0000000000 --- a/src/runtime/sleep_custom_default.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build !(scheduler.tasks && uefi) - -package runtime - -func schedulerSleepCustom(duration int64) bool { - return false -} diff --git a/targets/uefi-amd64.json b/targets/uefi-amd64.json index c594aecce6..a3c0875bba 100644 --- a/targets/uefi-amd64.json +++ b/targets/uefi-amd64.json @@ -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"] }