summaryrefslogtreecommitdiff
path: root/kernel/src
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src')
-rw-r--r--kernel/src/boot.asm6
-rw-r--r--kernel/src/lib.rs9
-rw-r--r--kernel/src/long_mode_init.asm4
-rw-r--r--kernel/src/vga_text.rs7
4 files changed, 15 insertions, 11 deletions
diff --git a/kernel/src/boot.asm b/kernel/src/boot.asm
index e3484c1..451e455 100644
--- a/kernel/src/boot.asm
+++ b/kernel/src/boot.asm
@@ -22,7 +22,7 @@ check_multiboot:
cmp eax, 0x36d76289
jne .no_multiboot
ret
-.no_multiboot
+.no_multiboot:
mov al, "0"
jmp error
@@ -75,7 +75,7 @@ check_long_mode:
jz .no_long_mode
ret
-.no_long_mode
+.no_long_mode:
mov al, "2"
jmp error
@@ -160,5 +160,5 @@ p3_table:
p2_table:
resb 4096
stack_bottom:
- resb 64
+ resb 4096
stack_top:
diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs
index a27f0a7..48cb93d 100644
--- a/kernel/src/lib.rs
+++ b/kernel/src/lib.rs
@@ -1,6 +1,6 @@
+#![no_main]
#![feature(compiler_builtins_lib)]
#![no_std]
-#![no_main]
extern crate compiler_builtins;
@@ -11,11 +11,16 @@ use core::fmt::Write;
#[no_mangle]
pub extern "C" fn _start() -> ! {
-
let mut stdout = vga_text::OStream::new();
stdout.clear();
+
write!(&mut stdout, "hello world!");
+ core::iter::successors(Some(0), |n| Some(n + 1))
+ .for_each(|n|
+ write!(&mut stdout, "hello world {}!", n).unwrap()
+ );
+
loop {}
}
diff --git a/kernel/src/long_mode_init.asm b/kernel/src/long_mode_init.asm
index 751af9b..8c1b1e7 100644
--- a/kernel/src/long_mode_init.asm
+++ b/kernel/src/long_mode_init.asm
@@ -16,6 +16,4 @@ long_mode_start:
mov qword [0xb8000], rax
extern _start
- call _start
-
- hlt
+ jmp _start
diff --git a/kernel/src/vga_text.rs b/kernel/src/vga_text.rs
index ef488e9..5298da7 100644
--- a/kernel/src/vga_text.rs
+++ b/kernel/src/vga_text.rs
@@ -35,10 +35,11 @@ impl CharState {
}
}
+#[no_mangle]
#[derive(Clone, Copy)]
pub struct VgaChar {
+ pub byte: u8,
pub state: CharState,
- pub byte: u8
}
impl VgaChar {
@@ -57,7 +58,7 @@ impl OStream {
pub fn new() -> Self {
Self {
pos: (0, 0),
- cursor: 0xb8000 as *mut VgaChar,
+ cursor: Self::at(0),
state: CharState::from_colors(Color::White, Color::Black)
}
}
@@ -85,7 +86,7 @@ impl OStream {
self.compute_cursor()
}
- fn set_char(&mut self, c: VgaChar) {
+ pub fn set_char(&mut self, c: VgaChar) {
unsafe {self.cursor.write_volatile(c)}
}