summaryrefslogtreecommitdiff
path: root/kernel/src/io/vga_text.rs
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/io/vga_text.rs')
-rw-r--r--kernel/src/io/vga_text.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/kernel/src/io/vga_text.rs b/kernel/src/io/vga_text.rs
index 277db73..72c4d85 100644
--- a/kernel/src/io/vga_text.rs
+++ b/kernel/src/io/vga_text.rs
@@ -23,7 +23,7 @@ pub const WIDTH: usize = 80;
pub const HEIGHT: usize = 25;
#[derive(Clone, Copy)]
-#[repr(C)]
+#[repr(C, packed)]
pub struct CharState(pub u8);
impl CharState {
@@ -40,9 +40,8 @@ impl CharState {
}
}
-#[no_mangle]
#[derive(Clone, Copy)]
-#[repr(C)]
+#[repr(C, packed)]
pub struct VgaChar {
pub byte: u8,
pub state: CharState,
@@ -58,7 +57,7 @@ pub struct OStream {
pos: (usize, usize),
cursor: *mut VgaChar,
state: CharState,
- centered_mode: bool
+ centered_mode: bool,
}
impl OStream {
@@ -158,10 +157,10 @@ impl OStream {
}
pub fn print_centered(&mut self, s: &[u8]) {
- let mut line_start = 0;
- let mut line_len = 0;
for line in s.split(|&c| c == b'\n') {
- if line.is_empty() { self.new_line() }
+ if line.is_empty() {
+ self.new_line()
+ }
for chunk in line.chunks(WIDTH) {
self.set_col((WIDTH - chunk.len()) >> 1);
self.put_bytes(chunk);