finish defining simple text output protocol

This commit is contained in:
wmpod2xwie 2024-06-20 18:02:22 +10:00
parent 845559a9f5
commit 43d9a42bec
3 changed files with 53 additions and 26 deletions

View File

@ -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

View File

@ -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,7 +31,11 @@ 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 {
@ -50,3 +65,13 @@ pub enum Attribute {
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,
}

View File

@ -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 {