Skip to content

Commit 0256353

Browse files
committed
Loader: call BmSetMemoryTypeInformationVariable
Note that BmSetMemoryTypeInformationVariable() is told by the loader that the image being loaded is *not* a boot application, which is a blatant lie. The reason for doing this is to prevent BmSetMemoryTypeInformationVariable() from performing a warm reset of the system due to a change in the memory type info. (Again, and again, and again...) This is an attempt to fix S4 (hibernate) entry/resume issues; see #12.
1 parent b5d0353 commit 0256353

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Application/Loader/Loader.c

+12
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ STATIC CHAR16* mDriverPaths[] = {
3636
};
3737

3838

39+
extern
40+
EFI_STATUS
41+
EFIAPI
42+
BmSetMemoryTypeInformationVariable(
43+
IN BOOLEAN Boot
44+
);
45+
46+
3947
STATIC
4048
BOOLEAN
4149
EFIAPI
@@ -511,6 +519,10 @@ TryBootOptionsInOrder(
511519

512520
// So again, DO NOT call this abortion:
513521
//BmSetMemoryTypeInformationVariable((BOOLEAN)((BootOptions[Index].Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_BOOT));
522+
//
523+
// OK, maybe call it after all, but pretend this is *not* a boot entry, so that the system will not go into an infinite boot (reset) loop.
524+
// This may or may not fix hibernation related issues (S4 entry/resume). See https://github.com/Mattiwatti/EfiGuard/issues/12
525+
BmSetMemoryTypeInformationVariable(FALSE);
514526

515527
// Ensure the image path is connected end-to-end by Dispatch()ing any required drivers through DXE services
516528
EfiBootManagerConnectDevicePath(BootOptions[Index].FilePath, NULL);

0 commit comments

Comments
 (0)