[FREELDR:UEFI] Implement missing cold reset in Reboot() function (#9092)

- Fix a WARN debug print (Reboot can be called from menu).
- Stabilize reboot fallback abstractions.
- Drop unimplemented path on ARM.

CORE-11954 CORE-17604
This commit is contained in:
Nguyen Duc Thinh
2026-05-30 14:20:58 +07:00
committed by Stanislav Motylkov
parent 7a80c49e56
commit 2a74f5e794
2 changed files with 21 additions and 10 deletions

View File

@@ -104,15 +104,32 @@ ExecuteLoaderCleanly(PVOID PreviousStack)
UNREACHABLE;
}
#ifndef _M_ARM
DECLSPEC_NORETURN
VOID __cdecl Reboot(VOID)
{
//TODO: Replace with a true firmware reboot eventually
WARN("Something has gone wrong - halting FreeLoader\n");
WARN("Performing cold reset\n");
if (GlobalSystemTable && GlobalSystemTable->RuntimeServices)
{
/* Attempt a native firmware cold reset */
GlobalSystemTable->RuntimeServices->ResetSystem(
EfiResetCold,
EFI_SUCCESS,
0,
NULL
);
}
/* Fallback dead-loop if runtime services are missing or fail to respond */
for (;;)
{
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64))
__halt();
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
__asm__ __volatile__("hlt");
#else
/* Fallback placeholder loop for other platforms */
NOTHING;
#endif
}
}
#endif

View File

@@ -34,12 +34,6 @@ extern ULONG gDiskReadBuffer, gFileSysBuffer;
#define DriveMapGetBiosDriveNumber(DeviceName) 0
DECLSPEC_NORETURN
FORCEINLINE VOID Reboot(VOID)
{
DbgBreakPoint();
}
typedef struct _PAGE_TABLE_ARM
{
HARDWARE_PTE_ARMV6 Pte[1024];