redux
This commit is contained in:
parent
ac8f047643
commit
46e30e7297
|
@ -1,13 +1,5 @@
|
||||||
#![allow(clippy::empty_loop)]
|
#![allow(clippy::empty_loop)]
|
||||||
|
|
||||||
use alloc::{format, string::String};
|
|
||||||
use shadeable::pixel_format::from_vga_16;
|
|
||||||
use vga::colors::Color16;
|
|
||||||
|
|
||||||
use crate::{ScreenBuffer, VgaBuffer, SCREEN_BUFFER};
|
|
||||||
|
|
||||||
// use crate::scheduler;
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
arch::{init, sloop},
|
arch::{init, sloop},
|
||||||
|
@ -18,15 +10,22 @@ use {
|
||||||
info::master,
|
info::master,
|
||||||
systeminfo::{KERNEL_VERSION, RELEASE_TYPE},
|
systeminfo::{KERNEL_VERSION, RELEASE_TYPE},
|
||||||
},
|
},
|
||||||
file::{File, PathRep},
|
file::PathRep,
|
||||||
relib::network::socket::SimpleSock,
|
relib::network::socket::{SimpleSock, Socket},
|
||||||
relib::network::socket::Socket,
|
|
||||||
scheduler::SCHEDULER,
|
scheduler::SCHEDULER,
|
||||||
|
VgaBuffer, SCREEN_BUFFER,
|
||||||
|
},
|
||||||
|
alloc::{
|
||||||
|
format,
|
||||||
|
string::{String, ToString},
|
||||||
|
vec,
|
||||||
},
|
},
|
||||||
alloc::{string::ToString, vec},
|
|
||||||
core::sync::atomic::{AtomicU64, Ordering::*},
|
core::sync::atomic::{AtomicU64, Ordering::*},
|
||||||
|
facepalm::start_facepalm,
|
||||||
lazy_static::lazy_static,
|
lazy_static::lazy_static,
|
||||||
log::*,
|
log::*,
|
||||||
|
shadeable::pixel_format::from_vga_16,
|
||||||
|
vga::colors::Color16,
|
||||||
};
|
};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
@ -40,11 +39,11 @@ pub fn kernel_main() -> ! {
|
||||||
init::init();
|
init::init();
|
||||||
log::set_max_level(BOOT_CONF.log_level());
|
log::set_max_level(BOOT_CONF.log_level());
|
||||||
|
|
||||||
use crate::scheduler::Priority;
|
{
|
||||||
|
{
|
||||||
let mut scheduler = SCHEDULER.lock();
|
let mut scheduler = SCHEDULER.lock();
|
||||||
|
|
||||||
use Priority::*;
|
use crate::scheduler::Priority::*;
|
||||||
|
|
||||||
let mut process_1 = scheduler.new_process(High);
|
let mut process_1 = scheduler.new_process(High);
|
||||||
process_1.capabilities.files = FileAccess::Some(vec![PathRep {
|
process_1.capabilities.files = FileAccess::Some(vec![PathRep {
|
||||||
location: FileLocations::Home,
|
location: FileLocations::Home,
|
||||||
|
@ -55,39 +54,26 @@ pub fn kernel_main() -> ! {
|
||||||
trace!("{:?}", ref_process);
|
trace!("{:?}", ref_process);
|
||||||
}
|
}
|
||||||
drop(scheduler);
|
drop(scheduler);
|
||||||
|
}
|
||||||
|
|
||||||
use crate::proto_filetable::contain::FILE_TABLE;
|
|
||||||
use crate::proto_filetable::file::FileLocations;
|
use crate::proto_filetable::file::FileLocations;
|
||||||
|
|
||||||
let mut file_table = FILE_TABLE.lock();
|
{
|
||||||
|
let mut sock_print_id = SimpleSock::new();
|
||||||
|
sock_print_id.register_protocol("Screen Printer".to_string());
|
||||||
|
sock_print_id.write(format!("🐑").into());
|
||||||
|
|
||||||
let mut new_file = File::new(FileLocations::Bin, "test".to_string(), "txt".to_string());
|
let mut mode = SCREEN_BUFFER.lock();
|
||||||
new_file.write_bytes(&[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00]);
|
|
||||||
file_table.add_file("wasm_test", new_file);
|
|
||||||
|
|
||||||
let file = file_table.get_file("wasm_test");
|
mode.force_redraw();
|
||||||
|
for current in (*String::from_utf8_lossy(&sock_print_id.peek().unwrap())).chars() {
|
||||||
match file {
|
mode.draw_char(0, 0, current, from_vga_16(Color16::Red));
|
||||||
Some(file) => {
|
|
||||||
let file_bytes = &file.data_pointer;
|
|
||||||
|
|
||||||
use crate::wasm::WasmProgram;
|
|
||||||
let ret = WasmProgram::new_from_bytes(file_bytes);
|
|
||||||
trace!("Binary Valid: {:?}", ret.validate_header());
|
|
||||||
}
|
}
|
||||||
None => {
|
mode.copy_to_buffer();
|
||||||
info!("File not found");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut abcde = SCREEN_BUFFER.lock();
|
start_facepalm();
|
||||||
abcde.force_redraw();
|
|
||||||
|
|
||||||
abcde.draw_filled_circle(100, 100, 300, 0x0000ffff);
|
|
||||||
abcde.draw_unfilled_rect(100, 100, 400, 200, 0xff0000ff);
|
|
||||||
abcde.draw_filled_rect(300, 300, 400, 400, 0xff0000ff);
|
|
||||||
abcde.draw_line(100, 100, 400, 200, 0xff0000ff);
|
|
||||||
abcde.copy_to_buffer();
|
|
||||||
|
|
||||||
sloop()
|
sloop()
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,6 @@ pub fn start_facepalm() {
|
||||||
info!("facepalm 🤦 launched!");
|
info!("facepalm 🤦 launched!");
|
||||||
info!("facepalm 🤦 version: {}", VERSION);
|
info!("facepalm 🤦 version: {}", VERSION);
|
||||||
info!("facepalm 🤦 {} mode", RELEASE_TYPE);
|
info!("facepalm 🤦 {} mode", RELEASE_TYPE);
|
||||||
|
|
||||||
|
// Drop into a debug shell
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue