Skip to content

Commit 2e59b95

Browse files
committed
esrt: fix ESRT GUID for EFI device
The EFI GUID in FreeBSD is layouted as following typedef struct efi_guid { uint32_t Data1; uint16_t Data2; uint16_t Data3; uint8_t Data4[8]; } efi_guid_t; Which means the Data1, Data2, Data3 should follows the little endian rule as the MSB should be in the right side. Also, the table_len in the ioctl argument of EFI_GET_TABLE should be follow the uuid structure. Fix it by reorder it.
1 parent a879e74 commit 2e59b95

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

framework_lib/src/esrt/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use log::{debug, error, info, trace};
1515
use std::prelude::v1::*;
1616

1717
use core::prelude::v1::derive;
18-
use guid_create::{Guid, GUID};
18+
use guid_create::{GUID, Guid};
1919

2020
#[cfg(target_os = "linux")]
2121
use std::fs;
@@ -506,8 +506,8 @@ pub fn get_esrt() -> Option<Esrt> {
506506
let mut table = EfiGetTableIoc {
507507
buf: std::ptr::null_mut(),
508508
uuid: SYSTEM_RESOURCE_TABLE_GUID_BYTES,
509-
buf_len: 0,
510509
table_len: 0,
510+
buf_len: 0,
511511
};
512512
unsafe {
513513
let fd = file.as_raw_fd();
@@ -532,7 +532,7 @@ pub const SYSTEM_RESOURCE_TABLE_GUID: GUID = GUID::build_from_components(
532532
&[0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80],
533533
);
534534
pub const SYSTEM_RESOURCE_TABLE_GUID_BYTES: [u8; 16] = [
535-
0xb1, 0x22, 0xa2, 0x63, 0x36, 0x61, 0x4f, 0x68, 0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80,
535+
0x63, 0xa2, 0x22, 0xb1, 0x61, 0x36, 0x68, 0x4f, 0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80,
536536
];
537537

538538
#[cfg(feature = "uefi")]

0 commit comments

Comments
 (0)