summaryrefslogtreecommitdiff
path: root/kernel/src/lib.rs
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2019-11-03 01:22:02 +0100
committerDennis Kobert <dennis@kobert.dev>2019-11-03 01:22:02 +0100
commitb47731c6fd99d80b1023d906dd4b3bb377e49438 (patch)
tree0777c9eef5c416b5e58e1c44ded42d7b53382c57 /kernel/src/lib.rs
parent41bff6a115b9625747f08651aa8209c6767254da (diff)
Merge: 41bff6a a2d6311
Diffstat (limited to 'kernel/src/lib.rs')
-rw-r--r--kernel/src/lib.rs25
1 files changed, 15 insertions, 10 deletions
diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs
index 08059ea..74daa8a 100644
--- a/kernel/src/lib.rs
+++ b/kernel/src/lib.rs
@@ -7,10 +7,11 @@
extern crate compiler_builtins;
-mod vga_text;
-use vga_text::OStream;
+mod io;
use core::fmt::Write;
+use io::vga_text;
+use io::vga_text::OStream;
#[cfg(test)]
pub fn test_runner(tests: &[&dyn Fn(&mut OStream)]) {
@@ -29,7 +30,6 @@ fn test01(stdout: &mut OStream) {
#[no_mangle]
pub extern "C" fn _start() -> ! {
-
if cfg!(test) {
#[cfg(test)]
test_main();
@@ -44,9 +44,7 @@ pub extern "C" fn _start() -> ! {
// panic!("i has panicing");
core::iter::successors(Some(0), |n| Some(n + 1))
- .for_each(|n|
- write!(&mut stdout, "hello world {}!", n).unwrap()
- );
+ .for_each(|n| write!(&mut stdout, "hello world {}!", n).unwrap());
loop {}
}
@@ -56,19 +54,26 @@ pub extern "C" fn _start() -> ! {
pub extern "C" fn panic_handler(_info: &core::panic::PanicInfo) -> ! {
let mut stderr = vga_text::OStream::new();
stderr.set_state(vga_text::CharState::from_colors(
- vga_text::Color::LightRed, vga_text::Color::Red));
+ vga_text::Color::LightRed,
+ vga_text::Color::Red,
+ ));
stderr.clear();
stderr.print(b"uff-os");
stderr.set_row(10);
stderr.set_state(vga_text::CharState::from_colors(
- vga_text::Color::White, vga_text::Color::Red));
+ vga_text::Color::White,
+ vga_text::Color::Red,
+ ));
stderr.print_centered(b"<kernel panic>");
stderr.set_row(14);
- let text = _info.payload()
+ let text = _info
+ .payload()
.downcast_ref::<&str>()
.unwrap_or(&"no panic informations are obtainable");
stderr.set_state(vga_text::CharState::from_colors(
- vga_text::Color::Cyan, vga_text::Color::Red));
+ vga_text::Color::Cyan,
+ vga_text::Color::Red,
+ ));
stderr.print_centered(text.as_bytes());
loop {}
}