Skip to content

Commit bae8fb6

Browse files
loader: Make arm and riscv kernel headers public
This header is equivalent to the boot_params header found at the top of x86 kernels. We want to make this struct public to use it in a fw_cfg implementation that reads the kernel header for both arm and x86 Signed-off-by: Alex Orozco <alexorozco@google.com>
1 parent fd6a83d commit bae8fb6

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

src/loader/pe/mod.rs

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,20 @@ impl std::error::Error for Error {}
7373
#[cfg(target_arch = "aarch64")]
7474
#[repr(C)]
7575
#[derive(Debug, Copy, Clone, Default)]
76+
#[allow(missing_docs)]
7677
// See kernel doc Documentation/arm64/booting.txt for more information.
7778
// All these fields should be little endian.
78-
struct arm64_image_header {
79-
code0: u32,
80-
code1: u32,
81-
text_offset: u64,
82-
image_size: u64,
83-
flags: u64,
84-
res2: u64,
85-
res3: u64,
86-
res4: u64,
87-
magic: u32,
88-
res5: u32,
79+
pub struct arm64_image_header {
80+
pub code0: u32,
81+
pub code1: u32,
82+
pub text_offset: u64,
83+
pub image_size: u64,
84+
pub flags: u64,
85+
pub res2: u64,
86+
pub res3: u64,
87+
pub res4: u64,
88+
pub magic: u32,
89+
pub res5: u32,
8990
}
9091

9192
#[cfg(target_arch = "aarch64")]
@@ -96,20 +97,21 @@ unsafe impl ByteValued for arm64_image_header {}
9697
#[cfg(target_arch = "riscv64")]
9798
#[repr(C)]
9899
#[derive(Debug, Copy, Clone, Default)]
100+
#[allow(missing_docs)]
99101
// See kernel doc Documentation/arch/riscv/boot-image-header.rst
100102
// All these fields should be little endian.
101-
struct riscv64_image_header {
102-
code0: u32,
103-
code1: u32,
104-
text_offset: u64,
105-
image_size: u64,
106-
flags: u64,
107-
version: u32,
108-
res1: u32,
109-
res2: u64,
110-
magic: u64,
111-
magic2: u32,
112-
res3: u32,
103+
pub struct riscv64_image_header {
104+
pub code0: u32,
105+
pub code1: u32,
106+
pub text_offset: u64,
107+
pub image_size: u64,
108+
pub flags: u64,
109+
pub version: u32,
110+
pub res1: u32,
111+
pub res2: u64,
112+
pub magic: u64,
113+
pub magic2: u32,
114+
pub res3: u32,
113115
}
114116

115117
#[cfg(target_arch = "riscv64")]

0 commit comments

Comments
 (0)