From 78a52f71022854bd35bcc0702e5d560729cccb29 Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 2 Dec 2022 08:51:21 -0600 Subject: [PATCH] Consolidating limine graphics --- ableos/src/graphics_limine.rs | 24 ++++++++++++++++++++++++ ableos/src/kmain.rs | 4 +++- ableos/src/lib.rs | 1 + base/home/able/kernel.md | 4 ---- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 ableos/src/graphics_limine.rs delete mode 100644 base/home/able/kernel.md diff --git a/ableos/src/graphics_limine.rs b/ableos/src/graphics_limine.rs new file mode 100644 index 0000000..c375276 --- /dev/null +++ b/ableos/src/graphics_limine.rs @@ -0,0 +1,24 @@ +// TODO: Reorganize and make part of this into a limine agnostic API for general purpose graphics +use crate::kmain::FRAMEBUFFER; +pub fn clear_screen() { + { + // TODO: setup a proper framebuffer handler + let fb_response = FRAMEBUFFER.get_response().get().unwrap(); + for fb in fb_response.framebuffers().unwrap() { + trace!("Framebuffer {}x{}", fb.width, fb.height); + trace!("{}", fb.memory_model); + trace!("{}", fb.bpp); + let mut count = 0; + let total = fb.width * fb.height * 3; + while count != total { + unsafe { + let fb_ptr = fb.address.as_mut_ptr().unwrap(); + *fb_ptr.offset((count).try_into().unwrap()) = 0x00; + *fb_ptr.offset((count + 1).try_into().unwrap()) = 0x00; + *fb_ptr.offset((count + 2).try_into().unwrap()) = 0x00; + } + count += 3; + } + } + } +} diff --git a/ableos/src/kmain.rs b/ableos/src/kmain.rs index bc7cd6a..d09f916 100644 --- a/ableos/src/kmain.rs +++ b/ableos/src/kmain.rs @@ -14,7 +14,7 @@ use crate::devices::pci; use crate::relib::network::socket::{SimpleSock, Socket}; use crate::{boot_conf::KernelConfig, scratchpad, systeminfo::RELEASE_TYPE}; // use crate::{boot_conf::KernelConfig, scratchpad, systeminfo::RELEASE_TYPE, TERM}; -use crate::{filesystem, hardware}; +use crate::{filesystem, graphics_limine, hardware}; use kernel::KERNEL_VERSION; use limine::LimineSmpInfo; use limine::{LimineFramebufferRequest, LimineSmpRequest}; @@ -131,6 +131,8 @@ pub fn kernel_main( // } // } + graphics_limine::clear_screen(); + scratchpad(); sloop() } diff --git a/ableos/src/lib.rs b/ableos/src/lib.rs index 201ece8..2c200a4 100644 --- a/ableos/src/lib.rs +++ b/ableos/src/lib.rs @@ -81,6 +81,7 @@ pub mod wasm_jumploader; pub mod allocator; // pub use allocator as aalloc; +pub mod graphics_limine; pub mod handle; pub mod hardware; pub mod ipc; diff --git a/base/home/able/kernel.md b/base/home/able/kernel.md deleted file mode 100644 index b4b1e54..0000000 --- a/base/home/able/kernel.md +++ /dev/null @@ -1,4 +0,0 @@ -Hi there :>$RED$ -hi -$GREEN$ -hi 3