diff --git a/src/os_loader.rs b/src/os_loader.rs index 601ffd1..8756075 100644 --- a/src/os_loader.rs +++ b/src/os_loader.rs @@ -11,13 +11,14 @@ pub mod simple_text_output; use core::panic::PanicInfo; use system_table::SystemTable; use types::Handle; +use simple_text_output::SimpleTextOutputProtocol; #[no_mangle] #[export_name = "efi_main"] extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemTable) -> usize { unsafe { let system_table_ref: &SystemTable = &*system_table; - let console_out: *mut structs::SimpleTextOutputProtocol = system_table_ref.console_out; + let console_out: *mut SimpleTextOutputProtocol = system_table_ref.console_out; } loop {}; 0 // EFI_SUCCESS diff --git a/src/simple_text_output.rs b/src/simple_text_output.rs index d5fdf13..1b96419 100644 --- a/src/simple_text_output.rs +++ b/src/simple_text_output.rs @@ -2,7 +2,18 @@ use crate::structs::Status; use crate::types::Char16; #[repr(C)] -pub struct SimpleTextOutputProtocol {} +pub struct SimpleTextOutputProtocol { + reset: text_reset, + output_string: text_string, + test_string: text_test_string, + query_mode: text_query_mode, + set_mode: text_set_mode, + set_attribute: text_set_attribute, + clear_screen: text_clear_screen, + set_cursor_position: text_set_cursor_position, + enable_cursor: text_enable_cursor, + mode: *mut SimpleTextOutputMode, +} pub type text_reset = extern "efiapi" fn(this: &SimpleTextOutputProtocol, extended_verification: bool) -> Status; @@ -20,33 +31,47 @@ pub type text_set_mode = extern "efiapi" fn(this: &SimpleTextOutputProtocol, mode_number: usize) -> Status; pub type text_set_attribute = extern "efiapi" fn(this: &SimpleTextOutputProtocol, Attribute: usize) -> Status; - +pub type text_clear_screen = extern "efiapi" fn(this: SimpleTextOutputProtocol) -> Status; +pub type text_set_cursor_position = + extern "efiapi" fn(this: &SimpleTextOutputProtocol, column: usize, row: usize) -> Status; +pub type text_enable_cursor = + extern "efiapi" fn(this: &SimpleTextOutputProtocol, visible: bool) -> Status; #[repr(C)] pub enum Attribute { - Black = 0x00 , - Blue = 0x01 , - Green = 0x02 , - Cyan = 0x03 , - Red = 0x04 , - Magenta = 0x05 , - Brown = 0x06 , - LightGray = 0x07 , - Bright = 0x08 , + Black = 0x00, + Blue = 0x01, + Green = 0x02, + Cyan = 0x03, + Red = 0x04, + Magenta = 0x05, + Brown = 0x06, + LightGray = 0x07, + Bright = 0x08, // DarkGray = 0x08 , - LightBlue = 0x09 , - LightGreen = 0x0a , - LightCyan = 0x0b , - LightRed = 0x0c , - LightMagenta = 0x0d , - Yellow = 0x0e , - White = 0x0f , + LightBlue = 0x09, + LightGreen = 0x0a, + LightCyan = 0x0b, + LightRed = 0x0c, + LightMagenta = 0x0d, + Yellow = 0x0e, + White = 0x0f, // BackgroundBlack = 0x00 , - BackgroundBlue = 0x10 , - BackgroundGreen = 0x20 , - BackgroundCyan = 0x30 , - BackgroundRed = 0x40 , - BackgroundMagenta = 0x50 , - BackgroundBrown = 0x60 , - BackgroundLightGray = 0x70 , + BackgroundBlue = 0x10, + BackgroundGreen = 0x20, + BackgroundCyan = 0x30, + BackgroundRed = 0x40, + BackgroundMagenta = 0x50, + BackgroundBrown = 0x60, + BackgroundLightGray = 0x70, +} + +#[repr(C)] +pub struct SimpleTextOutputMode { + max_mode: i32, + mode: i32, + attribute: i32, + cursor_column: i32, + cursor_row: i32, + cursor_visible: bool, } diff --git a/src/system_table.rs b/src/system_table.rs index 5218b7f..bd07897 100644 --- a/src/system_table.rs +++ b/src/system_table.rs @@ -1,6 +1,7 @@ use crate::boot_services::BootServicesTable; use crate::structs::*; use crate::types::Handle; +use crate::simple_text_output::SimpleTextOutputProtocol; #[repr(C)] pub struct SystemTable {