Skip to content
Snippets Groups Projects
Commit dfcf5be7 authored by Aaron Janse's avatar Aaron Janse
Browse files

use logging instead of println

parent 0590a71b
No related branches found
No related tags found
1 merge request!149Use logging instead of println in src/lib.rs
...@@ -83,6 +83,8 @@ pub mod common; ...@@ -83,6 +83,8 @@ pub mod common;
pub mod arch; pub mod arch;
pub use crate::arch::*; pub use crate::arch::*;
use crate::log::info;
/// Constants like memory locations /// Constants like memory locations
pub mod consts; pub mod consts;
...@@ -201,8 +203,8 @@ pub fn kmain(cpus: usize, env: &'static [u8]) -> ! { ...@@ -201,8 +203,8 @@ pub fn kmain(cpus: usize, env: &'static [u8]) -> ! {
context::init(); context::init();
let pid = syscall::getpid(); let pid = syscall::getpid();
println!("BSP: {:?} {}", pid, cpus); info!("BSP: {:?} {}", pid, cpus);
println!("Env: {:?}", ::core::str::from_utf8(env)); info!("Env: {:?}", ::core::str::from_utf8(env));
match context::contexts_mut().spawn(userspace_init) { match context::contexts_mut().spawn(userspace_init) {
Ok(context_lock) => { Ok(context_lock) => {
...@@ -238,7 +240,7 @@ pub fn kmain_ap(id: usize) -> ! { ...@@ -238,7 +240,7 @@ pub fn kmain_ap(id: usize) -> ! {
context::init(); context::init();
let pid = syscall::getpid(); let pid = syscall::getpid();
println!("AP {}: {:?}", id, pid); info!("AP {}: {:?}", id, pid);
loop { loop {
unsafe { unsafe {
...@@ -252,7 +254,7 @@ pub fn kmain_ap(id: usize) -> ! { ...@@ -252,7 +254,7 @@ pub fn kmain_ap(id: usize) -> ! {
} }
} }
} else { } else {
println!("AP {}: Disabled", id); info!("AP {}: Disabled", id);
loop { loop {
unsafe { unsafe {
...@@ -266,12 +268,12 @@ pub fn kmain_ap(id: usize) -> ! { ...@@ -266,12 +268,12 @@ pub fn kmain_ap(id: usize) -> ! {
/// Allow exception handlers to send signal to arch-independant kernel /// Allow exception handlers to send signal to arch-independant kernel
#[no_mangle] #[no_mangle]
pub extern fn ksignal(signal: usize) { pub extern fn ksignal(signal: usize) {
println!("SIGNAL {}, CPU {}, PID {:?}", signal, cpu_id(), context::context_id()); info!("SIGNAL {}, CPU {}, PID {:?}", signal, cpu_id(), context::context_id());
{ {
let contexts = context::contexts(); let contexts = context::contexts();
if let Some(context_lock) = contexts.current() { if let Some(context_lock) = contexts.current() {
let context = context_lock.read(); let context = context_lock.read();
println!("NAME {}", unsafe { ::core::str::from_utf8_unchecked(&context.name.lock()) }); info!("NAME {}", unsafe { ::core::str::from_utf8_unchecked(&context.name.lock()) });
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment