Skip to content

Commit

Permalink
Merge pull request #4 from hermitcore/note
Browse files Browse the repository at this point in the history
Add entry version note
  • Loading branch information
mkroening authored Jul 13, 2022
2 parents 1e19122 + 2a41cb4 commit 01d0f5f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/kernel.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
use core::fmt;

#[used]
#[link_section = ".note.hermit.entry-version"]
static ENTRY_VERSION: Note = Note {
header: Nhdr32 {
n_namesz: 7,
n_descsz: 1,
n_type: crate::NT_HERMIT_ENTRY_VERSION,
},
name: *b"HERMIT\0\0",
data: [1],
};

#[repr(C)]
struct Note {
header: Nhdr32,
name: [u8; 8],
data: [u8; 1],
}

#[repr(C)]
struct Nhdr32 {
n_namesz: u32,
n_descsz: u32,
n_type: u32,
}

use crate::{BootInfo, NetInfo, RawBootInfo, TlsInfo};

impl BootInfo {
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ type SerialPortBase = u16;
#[cfg(target_arch = "aarch64")]
type SerialPortBase = u32;

/// Note type for specifying the hermit entry version.
///
/// The note name for this is `HERMIT`.
///
/// The `desc` field will be 1 word, which specifies the hermit entry version.
pub const NT_HERMIT_ENTRY_VERSION: u32 = 0x5a00;

#[derive(Debug)]
pub struct BootInfo {
pub base: u64,
Expand Down

0 comments on commit 01d0f5f

Please sign in to comment.