Skip to content

Commit 76df3e5

Browse files
committed
Clarify that the BootInfo struct is _not_ FFI-safe
1 parent bf68296 commit 76df3e5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/boot_info.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::memory_map::MemoryRegion;
22
use core::slice;
33

44
#[derive(Debug)]
5-
#[repr(C)]
65
pub struct BootInfo {
76
pub memory_regions: &'static mut [MemoryRegion],
87
pub framebuffer: Option<FrameBuffer>,
@@ -13,7 +12,6 @@ pub struct BootInfo {
1312
}
1413

1514
#[derive(Debug)]
16-
#[repr(C)]
1715
pub struct FrameBuffer {
1816
pub(crate) buffer_start: u64,
1917
pub(crate) buffer_byte_len: usize,
@@ -35,7 +33,6 @@ impl FrameBuffer {
3533
}
3634

3735
#[derive(Debug, Clone, Copy)]
38-
#[repr(C)]
3936
pub struct FrameBufferInfo {
4037
pub byte_len: usize,
4138
pub horizontal_resolution: usize,
@@ -46,12 +43,15 @@ pub struct FrameBufferInfo {
4643
}
4744

4845
#[derive(Debug, Clone, Copy)]
49-
#[repr(C)]
5046
#[non_exhaustive]
5147
pub enum PixelFormat {
5248
RGB,
5349
BGR,
5450
U8,
5551
}
5652

53+
/// Check that the _pointer_ is FFI-safe.
54+
///
55+
/// Note that the `BootInfo` struct is not FFI-safe, so it needs to be compiled by the same Rust
56+
/// compiler as the kernel in order to be safely accessed.
5757
extern "C" fn _assert_ffi(_boot_info: &'static mut BootInfo) {}

0 commit comments

Comments
 (0)