UEFI: Add support for UEFI time and UEFI events; fix STOP \n -> \r\n conversion (#5549)

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

* apply EFI timezone offset
This commit is contained in:
Matthew Hiles
2026-07-24 13:29:42 -04:00
committed by GitHub
parent 528476f2b3
commit 259842dc2e
5 changed files with 151 additions and 4 deletions
+10 -2
View File
@@ -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
}