From 2ee47b9cffbbceaef97e6cb54eea039725112e08 Mon Sep 17 00:00:00 2001 From: rgimad <33692565+rgimad@users.noreply.github.com> Date: Sat, 1 Feb 2025 23:17:26 +0300 Subject: [PATCH] disable default watchdog timer tested on real laptop, works --- kernel/boot/bootx64.asm | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/kernel/boot/bootx64.asm b/kernel/boot/bootx64.asm index 98c04a7..4d68c7d 100644 --- a/kernel/boot/bootx64.asm +++ b/kernel/boot/bootx64.asm @@ -99,22 +99,33 @@ efi_print_hex: proc main _efi_handle, _efi_table mov [efi_handle], rcx mov [efi_table], rdx + mov rbx, rdx - mov rcx, [rdx+EFI_SYSTEM_TABLE.ConOut] - fstcall [rcx+EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset], rcx, 1 + ; reset the console + mov rcx, [rbx + EFI_SYSTEM_TABLE.ConOut] + fstcall [rcx + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset], rcx, 1 test eax, eax jnz $ ; loop if fail to init text - mov rdx, [efi_table] + ; disable the default watchdog timer, otherwise it will reboot the pc after 5 mins of this app work + mov rcx, [rbx + EFI_SYSTEM_TABLE.BootServices] + fstcall [rcx + EFI_BOOT_SERVICES.SetWatchdogTimer], rcx, 0, 0, 0, 0 + test eax, eax + jz @f + mov rcx, msg_failed_disable_watchdog + call efi_puts + jmp $ +@@: + mov rcx, msg_firmware_vendor call efi_puts - mov rcx, [rdx + EFI_SYSTEM_TABLE.FirmwareVendor] + mov rcx, [rbx + EFI_SYSTEM_TABLE.FirmwareVendor] call efi_puts mov rcx, msg_newline call efi_puts mov rcx, msg_firmware_revision call efi_puts - mov rcx, qword [rdx + EFI_SYSTEM_TABLE.FirmwareRevision] + mov ecx, [rbx + EFI_SYSTEM_TABLE.FirmwareRevision] call efi_print_hex mov rcx, msg_newline call efi_puts @@ -159,6 +170,7 @@ msg_2 du "Lorem ipsum ! !",13,10,0 msg_firmware_vendor du "UEFI vendor: ", 0 msg_firmware_revision du "UEFI revision: ", 0 msg_newline du 13,10,0 +msg_failed_disable_watchdog du "Failed to disable watchdog timer!", 13,10,0 section '.reloc' fixups data discardable