various changes and wat things

This commit is contained in:
Able 2022-01-07 10:31:47 -06:00
parent 6d31f4db29
commit 123a7d880f
16 changed files with 146 additions and 22 deletions

36
ableos/Cargo.lock generated
View file

@ -16,6 +16,7 @@ dependencies = [
"qoi_rs", "qoi_rs",
"spin", "spin",
"uart_16550", "uart_16550",
"vga",
"volatile 0.2.7", "volatile 0.2.7",
"wasmi", "wasmi",
"x86_64", "x86_64",
@ -45,6 +46,21 @@ version = "0.9.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b0718f186cd449b21f044683933284ed90fb83f3e13949ff0e03b0b6f02e38e" checksum = "6b0718f186cd449b21f044683933284ed90fb83f3e13949ff0e03b0b6f02e38e"
[[package]]
name = "conquer-once"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c6d3a9775a69f6d1fe2cc888999b67ed30257d3da4d2af91984e722f2ec918a"
dependencies = [
"conquer-util",
]
[[package]]
name = "conquer-util"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e763eef8846b13b380f37dfecda401770b0ca4e56e95170237bd7c25c7db3582"
[[package]] [[package]]
name = "cpuio" name = "cpuio"
version = "0.3.0" version = "0.3.0"
@ -64,6 +80,12 @@ dependencies = [
"libm", "libm",
] ]
[[package]]
name = "font8x8"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "875488b8711a968268c7cf5d139578713097ca4635a76044e8fe8eedf831d07e"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -191,6 +213,20 @@ dependencies = [
"x86_64", "x86_64",
] ]
[[package]]
name = "vga"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67cbcb7bfff998d176ffb8f2c3dfd6cb0fe62740e36dee6c64fc3928c01001bf"
dependencies = [
"bitflags",
"conquer-once",
"font8x8",
"num-traits",
"spinning_top",
"x86_64",
]
[[package]] [[package]]
name = "volatile" name = "volatile"
version = "0.2.7" version = "0.2.7"

View file

@ -30,6 +30,8 @@ linked_list_allocator = "0.9.0"
lliw = "0.2.0" lliw = "0.2.0"
qoi_rs = "*" qoi_rs = "*"
spin = "0.5.2" spin = "0.5.2"
vga = "*"
[dependencies.wasmi] [dependencies.wasmi]
default-features = false default-features = false

View file

@ -1,7 +1,9 @@
use crate::{ use crate::{
arch::{drivers::vga::WRITER, gdt}, arch::{drivers::vga::WRITER, gdt},
kmain::KEY_BUFFER,
print, println, print, println,
}; };
use alloc::string::ToString;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use pic8259::ChainedPics; use pic8259::ChainedPics;
use spin; use spin;
@ -97,7 +99,14 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
} }
} }
crate::kmain::key_entropy(character.try_into().unwrap()); let crazy = true;
if crazy {
let mut xyz = crate::kmain::KEY_BUFFER.lock();
println!("{:?}", &xyz);
xyz.push(character.try_into().unwrap());
crate::kmain::key_entropy(character.try_into().unwrap());
}
} }
DecodedKey { DecodedKey {
kind: DecodedKeyKind::RawKey, kind: DecodedKeyKind::RawKey,

View file

@ -2,7 +2,6 @@ use crate::{
arch::drivers::vga::{set_vga_color, Color}, arch::drivers::vga::{set_vga_color, Color},
kprint, kprint,
}; };
pub fn colorify(eval: &str) { pub fn colorify(eval: &str) {
let y = eval.split("$"); let y = eval.split("$");
for z in y { for z in y {

View file

@ -0,0 +1,7 @@
pub struct Compositor {}
impl Compositor {
pub fn new() -> Self {
Self {}
}
}

View file

@ -0,0 +1,3 @@
//!
pub mod window;
pub mod compositor;

View file

@ -1,15 +1,31 @@
//! used to give a base line example of windows and window handling
use crate::driver_traits::graphics::Point; use crate::driver_traits::graphics::Point;
use alloc::string::String;
use alloc::vec::Vec;
pub struct MenuOption {
symbol: char,
}
pub type MenuBar = Vec<MenuOption>;
pub struct Window { pub struct Window {
// title: String, title: String,
position: Point, position: Point,
fullscreen: bool, fullscreen: bool,
} }
// all of these should return a result // all of these should return a result
impl Window { impl Window {
pub fn fullscreen(&mut self) -> Result<(), u8> { pub fn new(title: String, position: Point, fullscreen: bool) -> Self {
Self {
title,
position,
fullscreen,
}
}
pub fn fullscreen(&mut self) {
self.fullscreen = true; self.fullscreen = true;
Ok(())
} }
pub fn revert_fullscreen(&mut self) { pub fn revert_fullscreen(&mut self) {
self.fullscreen = false; self.fullscreen = false;

View file

@ -0,0 +1 @@

View file

@ -2,14 +2,12 @@
pub mod absi; pub mod absi;
pub mod clip; pub mod clip;
pub mod compositor;
pub mod futex;
pub mod info;
pub mod kinfo;
pub mod mail;
pub mod server; pub mod server;
pub mod systeminfo; pub mod systeminfo;
pub mod virtual_memory; pub mod virtual_memory;
// pub mod wm;
// added for experimental use
pub mod kinfo;
pub mod mail;
pub mod futex;
pub mod info;
pub const BANNER: &str = include_str!("banner.txt"); pub const BANNER: &str = include_str!("banner.txt");

View file

@ -1,6 +1,8 @@
#![allow(clippy::empty_loop)] #![allow(clippy::empty_loop)]
use crate::{experiments::info::master, relib::clparse}; use alloc::string::{String, ToString};
use crate::{experiments::info::master, log::LOG_STATE, relib::clparse, vga_e};
use { use {
crate::{ crate::{
@ -19,11 +21,11 @@ use {
pub extern "C" fn stack_overflow() -> u8 { pub extern "C" fn stack_overflow() -> u8 {
stack_overflow(); stack_overflow();
// meme number // meme number
69 // NOTE: Any specific reason for this number asside from memes? 69 // NOTE: Any specific reason for this number aside from memes?
} }
lazy_static! { lazy_static! {
pub static ref KEY_BUFFER: [DecodedKey; 256] = [DecodedKey::RawKey(123); 256]; pub static ref KEY_BUFFER: spin::Mutex<String> = spin::Mutex::new("".to_string());
pub static ref KEY_BUFFER_POINTER: u8 = 0; pub static ref KEY_BUFFER_POINTER: u8 = 0;
pub static ref THREAD_LIST: spin::Mutex<ThreadList> = spin::Mutex::new(vec![]); pub static ref THREAD_LIST: spin::Mutex<ThreadList> = spin::Mutex::new(vec![]);
pub static ref TICK: spin::Mutex<u64> = spin::Mutex::new(0); pub static ref TICK: spin::Mutex<u64> = spin::Mutex::new(0);
@ -32,6 +34,7 @@ lazy_static! {
#[no_mangle] #[no_mangle]
pub fn kernel_main() -> ! { pub fn kernel_main() -> ! {
init::init(); init::init();
// LOG_STATE.lock().log_to_screen = false; // LOG_STATE.lock().log_to_screen = false;
let mut a_thread = Thread::new(); let mut a_thread = Thread::new();
@ -39,13 +42,11 @@ pub fn kernel_main() -> ! {
a_thread.new_task(test_fn); a_thread.new_task(test_fn);
a_thread.new_task(test_fn); a_thread.new_task(test_fn);
THREAD_LIST.lock().push(a_thread); THREAD_LIST.lock().push(a_thread);
GraphicsBuffer::draw(); GraphicsBuffer::draw();
GraphicsBuffer::hide_cursor(); GraphicsBuffer::hide_cursor();
crate::wasm::evaluate(); crate::wasm::evaluate();
info!("{} v{}", RELEASE_TYPE, KERNEL_VERSION); info!("{} v{}", RELEASE_TYPE, KERNEL_VERSION);
info!( info!(
"Brand String: {:?}", "Brand String: {:?}",
master().unwrap().brand_string().unwrap() master().unwrap().brand_string().unwrap()
@ -57,6 +58,9 @@ pub fn kernel_main() -> ! {
{ {
clparse::test(); clparse::test();
} }
// vga_e::test_it_fucko();
// stack_overflow(); // stack_overflow();
// crate::arch::shutdown(); // crate::arch::shutdown();
sloop() sloop()

View file

@ -42,3 +42,6 @@ pub mod wasm;
pub extern crate alloc; pub extern crate alloc;
pub extern crate externc_libm as libm; pub extern crate externc_libm as libm;
///////////////////////////////
pub mod vga_e;

View file

@ -42,7 +42,11 @@ impl Log for ANSISerialLogger {
); );
} }
if LOG_STATE.lock().log_to_screen { if LOG_STATE.lock().log_to_screen {
println!("[$BLUE$Debug$RESET$][$GREEN$FakeTempTime$RESET$] {}", val); // NOTE: LIGHTBLUE because gamma color theory probably
println!(
"[$LIGHTBLUE$Debug$RESET$][$GREEN$FakeTempTime$RESET$] {}",
val
);
} }
} }
fn error(val: &str) { fn error(val: &str) {

View file

@ -5,7 +5,7 @@ use {
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
println!("{}", info); // println!("{}", info);
error!("{}", info); error!("{}", info);
sloop() sloop()
} }

41
ableos/src/vga_e.rs Normal file
View file

@ -0,0 +1,41 @@
use alloc::string::String;
use vga::colors::Color16;
use vga::writers::{Graphics640x480x16, GraphicsWriter};
pub fn test_it_fucko() {
let mode = Graphics640x480x16::new();
mode.set_mode();
mode.clear_screen(Color16::Black);
mode.draw_line((80, 60), (80, 420), Color16::White);
mode.draw_line((80, 60), (540, 60), Color16::White);
{
let offset = 110;
mode.draw_character(offset - 15 - 4, 60 + 15 - 4, 'x', Color16::Red);
mode.draw_line(
(offset.try_into().unwrap(), 60),
(offset.try_into().unwrap(), 90),
Color16::White,
);
}
mode.draw_line((80, 420), (540, 420), Color16::White);
mode.draw_line((540, 420), (540, 60), Color16::White);
mode.draw_line((80, 90), (540, 90), Color16::White);
for (offset, character) in "ableOS".chars().enumerate() {
mode.draw_character(270 + offset * 8, 72, character, Color16::White)
}
}
pub trait GraphicsAPI {
fn addShader() {}
}
pub struct Buffer {
label: String,
resolution: (u64, u64),
// pointer
}

View file

@ -51,7 +51,7 @@ impl Externals for HostFunctions {
} }
let arg: u64 = args.nth(0); let arg: u64 = args.nth(0);
let buf = unsafe { String::from_utf8_unchecked(arg.to_le_bytes().to_vec()) }; let buf = unsafe { String::from_utf8_unchecked(arg.to_le_bytes().to_vec()) };
println!["helllooooooo{}", buf]; println!["{}", buf];
Ok(None) Ok(None)
} }
SysCall::CONSOLE_GET_TITLE => Ok(None), SysCall::CONSOLE_GET_TITLE => Ok(None),
@ -90,7 +90,8 @@ impl ModuleImportResolver for HostFunctions {
} }
pub fn evaluate() { pub fn evaluate() {
let wasm_binary = include_bytes!("bin/console_out_test.wasm"); // let wasm_binary = include_bytes!("bin/console_out_test.wasm");
let wasm_binary = include_bytes!("bin/rust.wasm");
// Load wasm binary and prepare it for instantiation. // Load wasm binary and prepare it for instantiation.
let module = wasmi::Module::from_buffer(&wasm_binary).expect("failed to load wasm"); let module = wasmi::Module::from_buffer(&wasm_binary).expect("failed to load wasm");

View file