From 139a3a923c3c355fd65000429fee43da762e7f7d Mon Sep 17 00:00:00 2001 From: Matthew Hiles Date: Thu, 23 Jul 2026 13:11:04 -0400 Subject: [PATCH 1/8] add support for UEFI time and UEFI events; fix STOP \n -> \r\n conversion --- src/device/uefi/runtime.go | 21 ++++++++ src/device/uefi/tables.go | 8 +++ src/device/uefi/time.go | 101 ++++++++++++++++++++++++++++++++++++ src/machine/machine_uefi.go | 10 +++- src/runtime/runtime_uefi.go | 12 ++++- 5 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 src/device/uefi/runtime.go create mode 100644 src/device/uefi/time.go diff --git a/src/device/uefi/runtime.go b/src/device/uefi/runtime.go new file mode 100644 index 0000000000..532b02abf3 --- /dev/null +++ b/src/device/uefi/runtime.go @@ -0,0 +1,21 @@ +package uefi + +import _ "unsafe" + +//go:linkname gosched runtime.Gosched +func gosched() + +// WaitForEvent blocks while yielding to the TinyGo scheduler so other +// goroutines can continue to run. +func WaitForEvent(event EFI_EVENT) EFI_STATUS { + for { + status := BS().CheckEvent(event) + if status == EFI_SUCCESS { + return EFI_SUCCESS + } + if status != EFI_NOT_READY { + return status + } + gosched() + } +} diff --git a/src/device/uefi/tables.go b/src/device/uefi/tables.go index 230cbc8005..8eb2bf825b 100644 --- a/src/device/uefi/tables.go +++ b/src/device/uefi/tables.go @@ -20,6 +20,10 @@ type EFI_RUNTIME_SERVICES struct { queryVariableInfo uintptr } +func (p *EFI_RUNTIME_SERVICES) GetTime(time *EFI_TIME, capabilities *EFI_TIME_CAPABILITIES) EFI_STATUS { + return UefiCall2(p.getTime, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(capabilities))) +} + type EFI_BOOT_SERVICES struct { Hdr EFI_TABLE_HEADER raiseTPL uintptr @@ -82,6 +86,10 @@ func (p *EFI_BOOT_SERVICES) WaitForEvent(numberOfEvents UINTN, event *EFI_EVENT, return UefiCall3(p.waitForEvent, uintptr(numberOfEvents), uintptr(unsafe.Pointer(event)), uintptr(unsafe.Pointer(index))) } +func (p *EFI_BOOT_SERVICES) SignalEvent(event EFI_EVENT) EFI_STATUS { + return UefiCall1(p.signalEvent, uintptr(event)) +} + func (p *EFI_BOOT_SERVICES) CloseEvent(event EFI_EVENT) EFI_STATUS { return UefiCall1(p.closeEvent, uintptr(event)) } diff --git a/src/device/uefi/time.go b/src/device/uefi/time.go new file mode 100644 index 0000000000..35153847e1 --- /dev/null +++ b/src/device/uefi/time.go @@ -0,0 +1,101 @@ +package uefi + +type EFI_TIME struct { + Year uint16 + Month byte + Day byte + Hour byte + Minute byte + Second byte + Pad1 byte + Nanosecond uint32 + TimeZone int16 + Daylight byte + Pad2 byte +} + +type EFI_TIME_CAPABILITIES struct { + Resolution uint32 + Accuracy uint32 + SetsToZero BOOLEAN +} + +func GetTime() (EFI_TIME, EFI_STATUS) { + var time EFI_TIME + status := ST().RuntimeServices.GetTime(&time, nil) + return time, status +} + +func (t *EFI_TIME) GetEpoch() (sec int64, nsec int32) { + year := int(t.Year) + month := int(t.Month) + + d := daysSinceEpoch(year) + d += uint64(daysBefore[month-1]) + if isLeap(year) && month > 2 { + d++ + } + d += uint64(t.Day - 1) + + abs := d * secondsPerDay + abs += uint64(uint64(t.Hour)*uint64(secondsPerHour) + uint64(t.Minute)*uint64(secondsPerMinute) + uint64(t.Second)) + + sec = int64(abs) + (absoluteToInternal + internalToUnix) + nsec = int32(t.Nanosecond) + return +} + +const ( + secondsPerMinute = 60 + secondsPerHour = 60 * secondsPerMinute + secondsPerDay = 24 * secondsPerHour + daysPer400Years = 365*400 + 97 + daysPer100Years = 365*100 + 24 + daysPer4Years = 365*4 + 1 + + absoluteZeroYear = -292277022399 + internalYear = 1 + + absoluteToInternal int64 = (absoluteZeroYear - internalYear) * 365.2425 * secondsPerDay + unixToInternal int64 = (1969*365 + 1969/4 - 1969/100 + 1969/400) * secondsPerDay + internalToUnix int64 = -unixToInternal +) + +var daysBefore = [...]int32{ + 0, + 31, + 31 + 28, + 31 + 28 + 31, + 31 + 28 + 31 + 30, + 31 + 28 + 31 + 30 + 31, + 31 + 28 + 31 + 30 + 31 + 30, + 31 + 28 + 31 + 30 + 31 + 30 + 31, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31, +} + +func daysSinceEpoch(year int) uint64 { + y := uint64(int64(year) - absoluteZeroYear) + + n := y / 400 + y -= 400 * n + d := daysPer400Years * n + + n = y / 100 + y -= 100 * n + d += daysPer100Years * n + + n = y / 4 + y -= 4 * n + d += daysPer4Years * n + + d += 365 * y + return d +} + +func isLeap(year int) bool { + return year%4 == 0 && (year%100 != 0 || year%400 == 0) +} diff --git a/src/machine/machine_uefi.go b/src/machine/machine_uefi.go index 94659d2b3e..9d655f0f43 100644 --- a/src/machine/machine_uefi.go +++ b/src/machine/machine_uefi.go @@ -9,8 +9,10 @@ import ( const deviceName = "UEFI" type ( - EFI_STATUS = deviceuefi.EFI_STATUS - TextOutput = deviceuefi.TextOutput + EFI_STATUS = deviceuefi.EFI_STATUS + EFI_TIME = deviceuefi.EFI_TIME + EFI_TIME_CAPABILITIES = deviceuefi.EFI_TIME_CAPABILITIES + TextOutput = deviceuefi.TextOutput Error = deviceuefi.Error ) @@ -88,6 +90,10 @@ var ( ErrHTTPError = deviceuefi.ErrHTTPError ) +func GetTime() (EFI_TIME, EFI_STATUS) { + return deviceuefi.GetTime() +} + func ConsoleOut() *TextOutput { return deviceuefi.ConsoleOut() } diff --git a/src/runtime/runtime_uefi.go b/src/runtime/runtime_uefi.go index c97ab748eb..9104adb82a 100644 --- a/src/runtime/runtime_uefi.go +++ b/src/runtime/runtime_uefi.go @@ -56,9 +56,8 @@ func sleepTicks(d timeUnit) { func putchar(c byte) { if c == '\n' { - buf := [4]uefi.CHAR16{'\r', 0, '\n', 0} + buf := [2]uefi.CHAR16{uefi.CHAR16('\r'), 0} uefi.ST().ConOut.OutputString(&buf[0]) - return } buf := [2]uefi.CHAR16{uefi.CHAR16(c), 0} uefi.ST().ConOut.OutputString(&buf[0]) @@ -103,6 +102,15 @@ func growHeap() bool { return false } +func init() { + mono := nanotime() + efiTime, status := uefi.GetTime() + if status == uefi.EFI_SUCCESS { + sec, nsec := efiTime.GetEpoch() + timeOffset.Store(sec*1000000000 + int64(nsec) - mono) + } +} + func SetWaitForEvents(f func()) { waitForEventsFunction = f } From c7fa0364d86d8da680856805e40c9f8dc6713c52 Mon Sep 17 00:00:00 2001 From: Matthew Hiles Date: Thu, 23 Jul 2026 20:20:09 -0400 Subject: [PATCH 2/8] make it so both scheduler=none and scheduler=tasks works --- compileopts/config.go | 6 +- src/internal/task/task_stack_amd64.go | 2 +- src/internal/task/task_stack_amd64_winabi.go | 58 ++++++++++++++++++++ src/runtime/sleep_custom_uefi.go | 14 +++++ targets/uefi-amd64.json | 2 +- 5 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 src/internal/task/task_stack_amd64_winabi.go create mode 100644 src/runtime/sleep_custom_uefi.go diff --git a/compileopts/config.go b/compileopts/config.go index 7786cd2178..1c38078fae 100644 --- a/compileopts/config.go +++ b/compileopts/config.go @@ -482,7 +482,11 @@ func (c *Config) LinkerFlavor() string { // ExtraFiles returns the list of extra files to be built and linked with the // executable. This can include extra C and assembly files. func (c *Config) ExtraFiles() []string { - return c.Target.ExtraFiles + files := append([]string(nil), c.Target.ExtraFiles...) + if c.Scheduler() == "tasks" && c.GOARCH() == "amd64" && slices.Contains(c.Target.BuildTags, "uefi") { + files = append(files, "src/internal/task/task_stack_amd64_windows.S") + } + return files } // DumpSSA returns whether to dump Go SSA while compiling (-dumpssa flag). Only 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_winabi.go b/src/internal/task/task_stack_amd64_winabi.go new file mode 100644 index 0000000000..3b9c2e22db --- /dev/null +++ b/src/internal/task/task_stack_amd64_winabi.go @@ -0,0 +1,58 @@ +//go:build scheduler.tasks && amd64 && uefi + +package task + +// This is almost the same as task_stack_amd64.go, but with the extra rdi and +// rsi registers saved: UEFI on amd64 uses the Win64 ABI. + +import "unsafe" + +var systemStack uintptr + +// calleeSavedRegs is the list of registers that must be saved and restored when +// switching between tasks. Also see task_stack_amd64_windows.S that relies on +// the exact layout of this struct. +type calleeSavedRegs struct { + // rbx is placed here so the stack is correctly aligned when saving XMM regs. + rbx uintptr + xmm15 [2]uint64 + xmm14 [2]uint64 + xmm13 [2]uint64 + xmm12 [2]uint64 + xmm11 [2]uint64 + xmm10 [2]uint64 + xmm9 [2]uint64 + xmm8 [2]uint64 + xmm7 [2]uint64 + xmm6 [2]uint64 + rbp uintptr + rdi uintptr + rsi uintptr + r12 uintptr + r13 uintptr + r14 uintptr + r15 uintptr + + pc uintptr +} + +func (s *state) archInit(r *calleeSavedRegs, fn uintptr, args unsafe.Pointer) { + s.sp = uintptr(unsafe.Pointer(r)) + r.pc = uintptr(unsafe.Pointer(&startTask)) + r.r12 = fn + r.r13 = uintptr(args) +} + +func (s *state) resume() { + swapTask(s.sp, &systemStack) +} + +func (s *state) pause() { + newStack := systemStack + systemStack = 0 + swapTask(newStack, &s.sp) +} + +func SystemStack() uintptr { + return systemStack +} diff --git a/src/runtime/sleep_custom_uefi.go b/src/runtime/sleep_custom_uefi.go new file mode 100644 index 0000000000..784f3b4f28 --- /dev/null +++ b/src/runtime/sleep_custom_uefi.go @@ -0,0 +1,14 @@ +//go:build scheduler.tasks && uefi + +package runtime + +//go:linkname gosched runtime.Gosched +func gosched() + +func schedulerSleepCustom(duration int64) bool { + deadline := ticks() + nanosecondsToTicks(duration) + for ticks() < deadline { + gosched() + } + return true +} diff --git a/targets/uefi-amd64.json b/targets/uefi-amd64.json index c594aecce6..da1f5943a3 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", From 7a3c621aabaa63ce7bc430fb43a479b0328cbbdd Mon Sep 17 00:00:00 2001 From: Matthew Hiles Date: Thu, 27 Aug 2026 09:59:23 -0400 Subject: [PATCH 3/8] 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. --- compileopts/config.go | 3 - src/internal/task/task_none.go | 5 ++ src/internal/task/task_stack_amd64_winabi.go | 33 ++++++- src/internal/task/task_stack_amd64_windows.go | 85 ------------------- src/runtime/sleep_custom_default.go | 2 - src/runtime/sleep_custom_uefi.go | 14 --- targets/uefi-amd64.json | 3 +- 7 files changed, 37 insertions(+), 108 deletions(-) delete mode 100644 src/internal/task/task_stack_amd64_windows.go delete mode 100644 src/runtime/sleep_custom_uefi.go diff --git a/compileopts/config.go b/compileopts/config.go index 1c38078fae..eb65bbf32e 100644 --- a/compileopts/config.go +++ b/compileopts/config.go @@ -483,9 +483,6 @@ func (c *Config) LinkerFlavor() string { // executable. This can include extra C and assembly files. func (c *Config) ExtraFiles() []string { files := append([]string(nil), c.Target.ExtraFiles...) - if c.Scheduler() == "tasks" && c.GOARCH() == "amd64" && slices.Contains(c.Target.BuildTags, "uefi") { - files = append(files, "src/internal/task/task_stack_amd64_windows.S") - } return files } diff --git a/src/internal/task/task_none.go b/src/internal/task/task_none.go index 7abd7a6bfc..e55cbfa3b6 100644 --- a/src/internal/task/task_none.go +++ b/src/internal/task/task_none.go @@ -19,6 +19,11 @@ func Current() *Task { return &mainTask } +//export tinygo_task_exit +func taskExit() { + runtimePanic("scheduler is disabled") +} + //go:noinline func start(fn uintptr, args unsafe.Pointer, stackSize uintptr) { // The compiler will error if this is reachable. diff --git a/src/internal/task/task_stack_amd64_winabi.go b/src/internal/task/task_stack_amd64_winabi.go index 3b9c2e22db..17d19d7c89 100644 --- a/src/internal/task/task_stack_amd64_winabi.go +++ b/src/internal/task/task_stack_amd64_winabi.go @@ -1,9 +1,9 @@ -//go:build scheduler.tasks && amd64 && uefi +//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: UEFI on amd64 uses the Win64 ABI. +// rsi registers saved: Windows and UEFI use the Win64 calling convention. import "unsafe" @@ -12,8 +12,16 @@ var systemStack uintptr // calleeSavedRegs is the list of registers that must be saved and restored when // switching between tasks. Also see task_stack_amd64_windows.S that relies on // the exact layout of this struct. +// The calling convention is described here: +// https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170 +// Most importantly, these are the registers we need to save/restore: +// +// > The x64 ABI considers registers RBX, RBP, RDI, RSI, RSP, R12, R13, R14, +// > R15, and XMM6-XMM15 nonvolatile. They must be saved and restored by a +// > function that uses them. type calleeSavedRegs struct { - // rbx is placed here so the stack is correctly aligned when saving XMM regs. + // Note: rbx is placed here so that the stack is correctly aligned when + // loading/storing the xmm registers. rbx uintptr xmm15 [2]uint64 xmm14 [2]uint64 @@ -36,10 +44,27 @@ type calleeSavedRegs struct { pc uintptr } +// archInit runs architecture-specific setup for the goroutine startup. func (s *state) archInit(r *calleeSavedRegs, fn uintptr, args unsafe.Pointer) { + // Store the initial sp for the startTask function (implemented in assembly). s.sp = uintptr(unsafe.Pointer(r)) + + // Initialize the registers. + // These will be popped off of the stack on the first resume of the goroutine. + + // Start the function at tinygo_startTask (defined in + // src/internal/task/task_stack_amd64_windows.S). This assembly code calls a + // function (passed in r12) with a single argument (passed in r13). After + // the function returns, it calls Pause(). r.pc = uintptr(unsafe.Pointer(&startTask)) + + // Pass the function to call in r12. + // This function is a compiler-generated wrapper which loads arguments out + // of a struct pointer. See createGoroutineStartWrapper (defined in + // compiler/goroutine.go) for more information. r.r12 = fn + + // Pass the pointer to the arguments struct in r13. r.r13 = uintptr(args) } @@ -53,6 +78,8 @@ func (s *state) pause() { swapTask(newStack, &s.sp) } +// SystemStack returns the system stack pointer when called from a task stack. +// When called from the system stack, it returns 0. func SystemStack() uintptr { return systemStack } diff --git a/src/internal/task/task_stack_amd64_windows.go b/src/internal/task/task_stack_amd64_windows.go deleted file mode 100644 index f174196f35..0000000000 --- a/src/internal/task/task_stack_amd64_windows.go +++ /dev/null @@ -1,85 +0,0 @@ -//go:build scheduler.tasks && amd64 && windows - -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. - -import "unsafe" - -var systemStack uintptr - -// calleeSavedRegs is the list of registers that must be saved and restored when -// switching between tasks. Also see task_stack_amd64_windows.S that relies on -// the exact layout of this struct. -// The calling convention is described here: -// https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170 -// Most importantly, these are the registers we need to save/restore: -// -// > The x64 ABI considers registers RBX, RBP, RDI, RSI, RSP, R12, R13, R14, -// > R15, and XMM6-XMM15 nonvolatile. They must be saved and restored by a -// > function that uses them. -type calleeSavedRegs struct { - // Note: rbx is placed here so that the stack is correctly aligned when - // loading/storing the xmm registers. - rbx uintptr - xmm15 [2]uint64 - xmm14 [2]uint64 - xmm13 [2]uint64 - xmm12 [2]uint64 - xmm11 [2]uint64 - xmm10 [2]uint64 - xmm9 [2]uint64 - xmm8 [2]uint64 - xmm7 [2]uint64 - xmm6 [2]uint64 - rbp uintptr - rdi uintptr - rsi uintptr - r12 uintptr - r13 uintptr - r14 uintptr - r15 uintptr - - pc uintptr -} - -// archInit runs architecture-specific setup for the goroutine startup. -func (s *state) archInit(r *calleeSavedRegs, fn uintptr, args unsafe.Pointer) { - // Store the initial sp for the startTask function (implemented in assembly). - s.sp = uintptr(unsafe.Pointer(r)) - - // Initialize the registers. - // These will be popped off of the stack on the first resume of the goroutine. - - // Start the function at tinygo_startTask (defined in - // src/internal/task/task_stack_amd64_windows.S). This assembly code calls a - // function (passed in r12) with a single argument (passed in r13). After - // the function returns, it calls Pause(). - r.pc = uintptr(unsafe.Pointer(&startTask)) - - // Pass the function to call in r12. - // This function is a compiler-generated wrapper which loads arguments out - // of a struct pointer. See createGoroutineStartWrapper (defined in - // compiler/goroutine.go) for more information. - r.r12 = fn - - // Pass the pointer to the arguments struct in r13. - r.r13 = uintptr(args) -} - -func (s *state) resume() { - swapTask(s.sp, &systemStack) -} - -func (s *state) pause() { - newStack := systemStack - systemStack = 0 - swapTask(newStack, &s.sp) -} - -// SystemStack returns the system stack pointer when called from a task stack. -// When called from the system stack, it returns 0. -func SystemStack() uintptr { - return systemStack -} diff --git a/src/runtime/sleep_custom_default.go b/src/runtime/sleep_custom_default.go index a32fe1dce3..54e1be03d6 100644 --- a/src/runtime/sleep_custom_default.go +++ b/src/runtime/sleep_custom_default.go @@ -1,5 +1,3 @@ -//go:build !(scheduler.tasks && uefi) - package runtime func schedulerSleepCustom(duration int64) bool { diff --git a/src/runtime/sleep_custom_uefi.go b/src/runtime/sleep_custom_uefi.go deleted file mode 100644 index 784f3b4f28..0000000000 --- a/src/runtime/sleep_custom_uefi.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build scheduler.tasks && uefi - -package runtime - -//go:linkname gosched runtime.Gosched -func gosched() - -func schedulerSleepCustom(duration int64) bool { - deadline := ticks() + nanosecondsToTicks(duration) - for ticks() < deadline { - gosched() - } - return true -} diff --git a/targets/uefi-amd64.json b/targets/uefi-amd64.json index da1f5943a3..a3c0875bba 100644 --- a/targets/uefi-amd64.json +++ b/targets/uefi-amd64.json @@ -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"] } From 4f0e6703e01b18ef9767372b937287ff46dc5378 Mon Sep 17 00:00:00 2001 From: Matthew Hiles Date: Thu, 27 Aug 2026 10:29:06 -0400 Subject: [PATCH 4/8] revert back to simpler return value for ExtraFiles() --- compileopts/config.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compileopts/config.go b/compileopts/config.go index eb65bbf32e..7786cd2178 100644 --- a/compileopts/config.go +++ b/compileopts/config.go @@ -482,8 +482,7 @@ func (c *Config) LinkerFlavor() string { // ExtraFiles returns the list of extra files to be built and linked with the // executable. This can include extra C and assembly files. func (c *Config) ExtraFiles() []string { - files := append([]string(nil), c.Target.ExtraFiles...) - return files + return c.Target.ExtraFiles } // DumpSSA returns whether to dump Go SSA while compiling (-dumpssa flag). Only From f2dd96aa77036e569af64fa21cafae404b16c8ce Mon Sep 17 00:00:00 2001 From: Matthew Hiles Date: Thu, 27 Aug 2026 13:26:53 -0400 Subject: [PATCH 5/8] create uefi specific tasks_none file --- src/internal/task/task_none.go | 5 ----- src/internal/task/task_none_uefi.go | 8 ++++++++ 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 src/internal/task/task_none_uefi.go diff --git a/src/internal/task/task_none.go b/src/internal/task/task_none.go index e55cbfa3b6..7abd7a6bfc 100644 --- a/src/internal/task/task_none.go +++ b/src/internal/task/task_none.go @@ -19,11 +19,6 @@ func Current() *Task { return &mainTask } -//export tinygo_task_exit -func taskExit() { - runtimePanic("scheduler is disabled") -} - //go:noinline func start(fn uintptr, args unsafe.Pointer, stackSize uintptr) { // The compiler will error if this is reachable. diff --git a/src/internal/task/task_none_uefi.go b/src/internal/task/task_none_uefi.go new file mode 100644 index 0000000000..b403e3e509 --- /dev/null +++ b/src/internal/task/task_none_uefi.go @@ -0,0 +1,8 @@ +//go:build scheduler.none && uefi + +package task + +//export tinygo_task_exit +func taskExit() { + runtimePanic("scheduler is disabled") +} From b968469cd3e82c578a1e56da64fee38d26468bf4 Mon Sep 17 00:00:00 2001 From: Matthew Hiles Date: Fri, 28 Aug 2026 09:26:42 -0400 Subject: [PATCH 6/8] remove unused sleepSchedulerCustom stuff --- lib/macos-minimal-sdk | 2 +- src/internal/task/task_none_uefi.go | 4 ++-- src/runtime/scheduler_cooperative.go | 4 ---- src/runtime/sleep_custom_default.go | 5 ----- 4 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 src/runtime/sleep_custom_default.go diff --git a/lib/macos-minimal-sdk b/lib/macos-minimal-sdk index 5f57dee4ae..e7c72156ea 160000 --- a/lib/macos-minimal-sdk +++ b/lib/macos-minimal-sdk @@ -1 +1 @@ -Subproject commit 5f57dee4ae50adb8062f53419e535f6aa065f699 +Subproject commit e7c72156eac3ebf29c34cc2faa71efcb1296663f diff --git a/src/internal/task/task_none_uefi.go b/src/internal/task/task_none_uefi.go index b403e3e509..cbe8d3b4cc 100644 --- a/src/internal/task/task_none_uefi.go +++ b/src/internal/task/task_none_uefi.go @@ -1,8 +1,8 @@ -//go:build scheduler.none && uefi +//go:build scheduler.none package task -//export tinygo_task_exit +//go:export tinygo_task_exit func taskExit() { runtimePanic("scheduler is disabled") } 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 54e1be03d6..0000000000 --- a/src/runtime/sleep_custom_default.go +++ /dev/null @@ -1,5 +0,0 @@ -package runtime - -func schedulerSleepCustom(duration int64) bool { - return false -} From 65258176588cd6f2edaffdfc2b2b5c809661fa37 Mon Sep 17 00:00:00 2001 From: Matthew Hiles Date: Fri, 28 Aug 2026 09:36:29 -0400 Subject: [PATCH 7/8] add back the uefi tag --- src/internal/task/task_none_uefi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal/task/task_none_uefi.go b/src/internal/task/task_none_uefi.go index cbe8d3b4cc..f4e755b84a 100644 --- a/src/internal/task/task_none_uefi.go +++ b/src/internal/task/task_none_uefi.go @@ -1,4 +1,4 @@ -//go:build scheduler.none +//go:build scheduler.none && uefi package task From bd7723b54bffd9a9ed3bb7ba65d47d8d88e2a46a Mon Sep 17 00:00:00 2001 From: Matthew Hiles Date: Fri, 28 Aug 2026 12:45:35 -0400 Subject: [PATCH 8/8] lib: restore macos-minimal-sdk pointer --- lib/macos-minimal-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/macos-minimal-sdk b/lib/macos-minimal-sdk index e7c72156ea..5f57dee4ae 160000 --- a/lib/macos-minimal-sdk +++ b/lib/macos-minimal-sdk @@ -1 +1 @@ -Subproject commit e7c72156eac3ebf29c34cc2faa71efcb1296663f +Subproject commit 5f57dee4ae50adb8062f53419e535f6aa065f699