Skip to content

Commit 9609873

Browse files
medhefgonicholasbishop
authored andcommitted
uefi-test-runner: Fix buffer alignment on ia32
1 parent b8d15a7 commit 9609873

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

uefi-test-runner/src/proto/media.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use alloc::string::ToString;
22
use core::cell::RefCell;
33
use core::ptr::NonNull;
4+
use uefi::data_types::Align;
45
use uefi::prelude::*;
56
use uefi::proto::media::block::BlockIO;
67
use uefi::proto::media::disk::{DiskIo, DiskIo2, DiskIo2Token};
@@ -29,8 +30,12 @@ fn test_existing_dir(directory: &mut Directory) {
2930

3031
let dir = RefCell::new(dir);
3132

33+
assert_eq!(FileInfo::alignment(), 8);
34+
#[repr(align(8))]
35+
struct Buf([u8; 200]);
36+
3237
// Backing memory to read the file info data into.
33-
let mut stack_buf = [0; 200];
38+
let mut stack_buf = Buf([0; 200]);
3439

3540
// The file names that the test read from the directory.
3641
let entry_names = RefCell::new(vec![]);
@@ -44,7 +49,7 @@ fn test_existing_dir(directory: &mut Directory) {
4449
let mut entry_names = entry_names.borrow_mut();
4550
loop {
4651
let entry = dir
47-
.read_entry(&mut stack_buf)
52+
.read_entry(&mut stack_buf.0)
4853
.expect("failed to read directory");
4954
if let Some(entry) = entry {
5055
entry_names.push(entry.file_name().to_string());

0 commit comments

Comments
 (0)