Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160582235
D56115.id174401.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D56115.id174401.diff
View Options
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -138,7 +138,6 @@
return (howto);
}
-
#ifdef EFI
static EFI_STATUS
efi_do_vmap(EFI_MEMORY_DESCRIPTOR *mm, UINTN sz, UINTN mmsz, UINT32 mmver)
@@ -172,16 +171,23 @@
static UINT64
efi_get_mono_count(void)
{
- UINT64 mono_count;
+ UINT64 mono_count;
+ uint32_t high_bits_mono_count;
+ uint32_t low_bits_mono_count;
+
EFI_STATUS mc_status;
+ // Gets the boot count, only high 32 bits contain it.
mc_status = BS->GetNextMonotonicCount(&mono_count);
- if (mc_status == EFI_SUCCESS)
- printf("monocount high 32 = %u \n", (uint32_t)(mono_count >> 32));
- else if (mc_status == EFI_DEVICE_ERROR)
- printf("Error on MonotonicCount : %lu\n", mc_status);
- else
- printf("Error on MonotonicCount : %lu\n", mc_status);
+ if (mc_status == EFI_DEVICE_ERROR)
+ printf("GetNextHighMonotonicCount error %lu\n", EFI_ERROR_CODE(mc_status));
+ else if (mc_status == EFI_INVALID_PARAMETER)
+ printf("GetNextHighMonotonicCount error %lu\n", EFI_ERROR_CODE(mc_status));
+
+ // Need to preserve low 32 bits too, for wraparound detection
+ high_bits_mono_count = (uint32_t)(mono_count >> 32);
+ low_bits_mono_count = (uint32_t)(mono_count << 32);
+ printf("monocount high 32 = %u \n", high_bits_mono_count);
return mono_count;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 26, 9:43 PM (14 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30498569
Default Alt Text
D56115.id174401.diff (1 KB)
Attached To
Mode
D56115: stand/efi: retrieving and printing the boot count
Attached
Detach File
Event Timeline
Log In to Comment