Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

avdgrinten
Copy link
Member

Small PR that helps with debugging on UEFI boot.

@avdgrinten avdgrinten requested a review from no92 September 17, 2025 20:22
return &s;
}

struct UefiAllocator {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to have a comment warning that these allocations should probably not survive past ExitBootServices.


auto n = frg::basic_string_view<char16_t>{devPathUtf16}.size();
frg::string<UefiAllocator> out{n};
for (size_t i = 0; i < n; ++i) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a helper function for this in helpers.hpp would be nicer than copy-pasting this code block, especially now that we can use the UefiAllocator with frg::string.

};

frg::string<UefiAllocator> devPathToString(efi_device_path_protocol *devPath) {
auto devPathUtf16 = devPathToText->convert_device_path_to_text(devPath, true, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should gracefully handle this protocol not being present on funny UEFI implementations.


// Get some essential protocols.
efi_guid devPathToTextGuid = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
EFI_CHECK(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should gracefully handle this protocol not being present on funny UEFI implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants