Skip to main content

htmos_boot_info/
lib.rs

1//! # Boot Information for the HyperText Markup Operating System
2//! 
3//! This also includes the entry calling convention and type for the kernel.
4//! 
5//! It's recommended to use the auto-assigned type HTMOSBootInformation, but I have provided explicit 32- and 64-bit versions of
6//! the struct for BIOS bootloading purposes.
7//! 
8//! When filling out the struct, the 'more_info' field of the struct is optional on BIOS systems; required otherwise.
9
10#![no_std]
11
12#[cfg(target_pointer_width = "32")]
13pub type HTMOSBootInformation = HTMOSBootInformation32;
14#[cfg(target_pointer_width = "64")]
15pub type HTMOSBootInformation = HTMOSBootInformation64;
16
17#[cfg(target_arch = "x86")]
18pub type HTMOSEntry = extern "cdecl" fn(*const HTMOSBootInformation) -> !;
19#[cfg(target_arch = "x86_64")]
20pub type HTMOSEntry = extern "sysv64" fn(*const HTMOSBootInformation) -> !;
21// As of right now, I haven't expanded at all on the other archs.  Defaulting to C.
22#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
23pub type HTMOSEntry = extern "C" fn(*const HTMOSBootInformation) -> !;
24
25/// Boot Information required for successful boot of the HyperText Markup Operation System on 32-bit systems.
26#[repr(C)]
27pub struct HTMOSBootInformation32 {
28    /// "HTMLBOOT" - 0x48544D4C424F4F54
29    /// 
30    /// HTMOS is forced to panic at the very beginning if this value is not presented correctly.
31    pub magic: u64,
32
33    /// Boot mode indicator
34    ///
35    /// - **0** - BIOS
36    /// - **1** - UEFI
37    pub boot_mode: u32,
38
39    /// Address to the Memory Map.
40    /// - **BIOS** - HTMOS only has support for the E820 Memory Map entries.
41    /// - **UEFI** - The memory map will be given to you close to exiting boot services.
42    pub memory_map_addr: u32,
43    /// Size of the Memory Map
44    pub memory_map_size: u32,
45    /// Size of a Memory Description
46    pub memory_desc_size: u32,
47
48    /// Base address for the Framebuffer
49    ///
50    /// HTMOS does not have support for VGA text (0xB8000) or the VGA buffer (0xA0000).
51    //To use the VGA buffer, **don't use VGA text** as HTMOS does not support that yet.
52    pub framebuffer_addr: u32,
53    /// Size of the Framebuffer (can be 0 for now, I will change it in the future to require a number > 0)
54    pub framebuffer_size: u32,
55    /// Number of pixels on a horizontal line
56    pub framebuffer_width: u32,
57    /// Number of pixels on a vertical line
58    pub framebuffer_height: u32,
59    /// Number of pixels per scan line
60    pub framebuffer_pitch: u32,
61    /// Pixel format (UEFI) or Bits Per Pixel (BIOS) of the Framebuffer
62    ///
63    /// - **BIOS** - This is bbp (**BITS** per pixel); it should come straight from the information given when converting to the framebuffer.
64    /// - **UEFI** - As of right now, I'm only aware of UEFI values 0x0 and 0x1.
65    pub framebuffer_format: u32,
66
67    /// **BIOS** - Address to raw config tables (if 0, HTMOS will find it manually)
68    ///
69    /// **UEFI** - Address to the System Table given at the UEFI entry point
70    pub more_info: u32,
71}
72
73/// Boot Information required for successful boot of the HyperText Markup Operation System on 64-bit systems.
74#[repr(C)]
75pub struct HTMOSBootInformation64 {
76    /// "HTMLBOOT" - 0x48544D4C424F4F54
77    /// 
78    /// HTMOS is forced to panic at the very beginning if this value is not presented correctly.
79    pub magic: u64,
80
81    /// Boot mode indicator
82    ///
83    /// - **0** - BIOS
84    /// - **1** - UEFI
85    pub boot_mode: u64,
86
87    /// Address to the Memory Map.
88    /// - **BIOS** - HTMOS only has support for the E820 Memory Map entries.
89    /// - **UEFI** - The memory map will be given to you close to exiting boot services.
90    pub memory_map_addr: u64,
91    /// Size of the Memory Map
92    pub memory_map_size: u64,
93    /// Size of a Memory Description
94    pub memory_desc_size: u64,
95
96    /// Base address for the Framebuffer
97    ///
98    /// HTMOS does not have support for VGA text (0xB8000) or the VGA buffer (0xA0000).
99    //To use the VGA buffer, **don't use VGA text** as HTMOS does not support that yet.
100    pub framebuffer_addr: u64,
101    /// Size of the Framebuffer (can be 0 for now, I will change it in the future to require a number > 0)
102    pub framebuffer_size: u64,
103    /// Number of pixels on a horizontal line
104    pub framebuffer_width: u32,
105    /// Number of pixels on a vertical line
106    pub framebuffer_height: u32,
107    /// Number of pixels per scan line
108    pub framebuffer_pitch: u32,
109    /// Pixel format (UEFI) or Bits Per Pixel (BIOS) of the Framebuffer
110    ///
111    /// - **BIOS** - This is bbp (**BITS** per pixel); it should come straight from the information given when converting to the framebuffer.
112    /// - **UEFI** - As of right now, I'm only aware of UEFI values 0x0 and 0x1.
113    pub framebuffer_format: u32,
114
115    /// **BIOS** - Address to raw config tables (if 0, HTMOS will find it manually)
116    ///
117    /// **UEFI** - Address to the System Table given at the UEFI entry point
118    pub more_info: u64,
119}