Skip to content

Commit e05d805

Browse files
committed
Use TagType everywhere
1 parent 8dcc7f5 commit e05d805

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

src/boot_loader_name.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
use crate::TagType;
2+
13
/// This Tag contains the name of the bootloader that is booting the kernel.
24
///
35
/// The name is a normal C-style UTF-8 zero-terminated string that can be
46
/// obtained via the `name` method.
57
#[derive(Clone, Copy, Debug)]
68
#[repr(C, packed)] // only repr(C) would add unwanted padding before first_section
79
pub struct BootLoaderNameTag {
8-
typ: u32,
10+
typ: TagType,
911
size: u32,
1012
string: u8,
1113
}

src/command_line.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
use crate::TagType;
2+
13
/// This Tag contains the command line string.
24
///
35
/// The string is a normal C-style UTF-8 zero-terminated string that can be
46
/// obtained via the `command_line` method.
57
#[derive(Clone, Copy, Debug)]
68
#[repr(C, packed)] // only repr(C) would add unwanted padding before first_section
79
pub struct CommandLineTag {
8-
typ: u32,
10+
typ: TagType,
911
size: u32,
1012
string: u8,
1113
}

src/memory_map.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use core::marker::PhantomData;
2+
use crate::TagType;
23

34
/// This Tag provides an initial host memory map.
45
///
@@ -13,7 +14,7 @@ use core::marker::PhantomData;
1314
#[derive(Debug)]
1415
#[repr(C)]
1516
pub struct MemoryMapTag {
16-
typ: u32,
17+
typ: TagType,
1718
size: u32,
1819
entry_size: u32,
1920
entry_version: u32,
@@ -45,6 +46,7 @@ impl MemoryMapTag {
4546
pub struct MemoryArea {
4647
base_addr: u64,
4748
length: u64,
49+
// TODO see spec
4850
typ: u32,
4951
_reserved: u32,
5052
}
@@ -122,7 +124,7 @@ impl<'a> Iterator for MemoryAreaIter<'a> {
122124
#[derive(Debug)]
123125
#[repr(C)]
124126
pub struct EFIMemoryMapTag {
125-
typ: u32,
127+
typ: TagType,
126128
size: u32,
127129
desc_size: u32,
128130
desc_version: u32,

src/module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use core::fmt::{Debug, Formatter};
66
#[derive(Clone, Copy)]
77
#[repr(C, packed)] // only repr(C) would add unwanted padding near name_byte.
88
pub struct ModuleTag {
9-
typ: u32,
9+
typ: TagType,
1010
size: u32,
1111
mod_start: u32,
1212
mod_end: u32,

src/rsdp.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
//!
66
//! Even though the bootloader should give the address of the real RSDP/XSDT, the checksum and
77
//! signature should be manually verified.
8-
98
use core::slice;
109
use core::str;
10+
use crate::TagType;
1111

1212
const RSDPV1_LENGTH: usize = 20;
1313

1414
/// EFI system table in 32 bit mode
1515
#[derive(Clone, Copy, Debug)]
1616
#[repr(C, packed)] // only repr(C) would add unwanted padding before first_section
1717
pub struct EFISdt32 {
18-
typ: u32,
18+
typ: TagType,
1919
size: u32,
2020
pointer: u32,
2121
}
@@ -31,7 +31,7 @@ impl EFISdt32 {
3131
#[derive(Clone, Copy, Debug)]
3232
#[repr(C)]
3333
pub struct EFISdt64 {
34-
typ: u32,
34+
typ: TagType,
3535
size: u32,
3636
pointer: u64,
3737
}
@@ -47,7 +47,7 @@ impl EFISdt64 {
4747
#[derive(Debug)]
4848
#[repr(C)]
4949
pub struct EFIImageHandle32 {
50-
typ: u32,
50+
typ: TagType,
5151
size: u32,
5252
pointer: u32,
5353
}
@@ -56,7 +56,7 @@ pub struct EFIImageHandle32 {
5656
#[derive(Debug)]
5757
#[repr(C)]
5858
pub struct EFIImageHandle64 {
59-
typ: u32,
59+
typ: TagType,
6060
size: u32,
6161
pointer: u64,
6262
}
@@ -66,7 +66,7 @@ pub struct EFIImageHandle64 {
6666
#[derive(Debug)]
6767
#[repr(C)]
6868
pub struct ImageLoadPhysAddr {
69-
typ: u32,
69+
typ: TagType,
7070
size: u32,
7171
load_base_addr: u32,
7272
}
@@ -75,7 +75,7 @@ pub struct ImageLoadPhysAddr {
7575
#[derive(Clone, Copy, Debug)]
7676
#[repr(C, packed)]
7777
pub struct RsdpV1Tag {
78-
typ: u32,
78+
typ: TagType,
7979
size: u32,
8080
signature: [u8; 8],
8181
checksum: u8,
@@ -122,7 +122,7 @@ impl RsdpV1Tag {
122122
#[derive(Clone, Copy, Debug)]
123123
#[repr(C, packed)]
124124
pub struct RsdpV2Tag {
125-
typ: u32,
125+
typ: TagType,
126126
size: u32,
127127
signature: [u8; 8],
128128
checksum: u8,

src/vbe_info.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
use core::fmt;
2+
use crate::TagType;
23

34
/// This tag contains VBE metadata, VBE controller information returned by the
45
/// VBE Function 00h and VBE mode information returned by the VBE Function 01h.
56
#[derive(Debug, Copy, Clone)]
67
#[repr(C, packed)]
78
pub struct VBEInfoTag {
8-
typ: u32,
9+
typ: TagType,
910
length: u32,
1011

1112
/// Indicates current video mode in the format specified in VBE 3.0.

0 commit comments

Comments
 (0)