Draw on VESA for console using ransid

This commit is contained in:
Jeremy Soller
2016-09-01 11:51:33 -06:00
parent ac9a475ef5
commit 5c91017579
3 changed files with 5 additions and 22 deletions

View File

@@ -1,15 +0,0 @@
use ransid::Console;
use spin::{Once, Mutex, MutexGuard};
/// Console
static CONSOLE: Once<Mutex<Console>> = Once::new();
/// Initialize console, called if needed
fn init_console() -> Mutex<Console> {
Mutex::new(Console::new(0, 0))
}
/// Get the global console
pub fn console() -> MutexGuard<'static, Console> {
CONSOLE.call_once(init_console).lock()
}

View File

@@ -80,7 +80,7 @@ impl ContextList {
}
context.arch.set_stack(stack.as_ptr() as usize + offset);
context.kstack = Some(stack);
print!("{}", format!("{}: {:X}\n", context.id, func as usize));
println!("{}: {:X}", context.id, func as usize);
}
Ok(context_lock)
}

10
lib.rs
View File

@@ -97,12 +97,8 @@ extern crate collections;
#[macro_use]
extern crate bitflags;
extern crate goblin;
extern crate ransid;
extern crate spin;
/// Console
pub mod console;
/// Context management
pub mod context;
@@ -134,7 +130,8 @@ pub extern fn context_test() {
pub extern fn kmain() {
context::init();
print!("{}", format!("BSP: {:?}\n", syscall::getpid()));
let pid = syscall::getpid();
println!("BSP: {:?}", pid);
if let Ok(_context_lock) = context::contexts_mut().spawn(context_test) {
print!("Spawned context\n");
@@ -153,7 +150,8 @@ pub extern fn kmain() {
pub extern fn kmain_ap(id: usize) {
context::init();
print!("{}", format!("AP {}: {:?}\n", id, syscall::getpid()));
let pid = syscall::getpid();
println!("AP {}: {:?}", id, pid);
loop {
unsafe { interrupt::enable_and_halt() }