Skip to content

Commit ac3c9c4

Browse files
committed
Send output to the serial port, rather than the video display
Signed-off-by: SlyMarbo <[email protected]>
1 parent d0b712c commit ac3c9c4

File tree

4 files changed

+23
-241
lines changed

4 files changed

+23
-241
lines changed

kernel/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ test-args = [
3232
run-command = [
3333
"qemu-system-x86_64",
3434
"-drive", "format=raw,file={}",
35-
"-device", "e1000,mac=01:23:45:67:89:ab",
36-
"-m", "128M",
37-
"-cpu", "Haswell"
35+
"-serial", "stdio",
36+
"-display", "none"
3837
]
3938

4039
[[test]]

kernel/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub mod interrupts;
1717
pub mod memory;
1818
pub mod serial;
1919
pub mod time;
20-
pub mod vga_buffer;
2120

2221
/// init sets up critical core functions of the kernel.
2322
///

kernel/src/serial.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,27 @@ pub fn _print(args: ::core::fmt::Arguments) {
2626
});
2727
}
2828

29+
/// print! is the standard printing macro, implemented
30+
/// using the _print function, which acquires SERIAL1
31+
/// using a spin lock and writes the message to the
32+
/// serial port.
33+
///
34+
#[macro_export]
35+
macro_rules! print {
36+
($($arg:tt)*) => ($crate::serial::_print(format_args!($($arg)*)));
37+
}
38+
39+
/// println! is the standard printing macro, implemented
40+
/// using the _print function, which acquires WRITER
41+
/// using a spin lock and writes the message to the
42+
/// VGA display.
43+
///
44+
#[macro_export]
45+
macro_rules! println {
46+
() => ($crate::print!("\n"));
47+
($($arg:tt)*) => ($crate::print!("{}\n", format_args!($($arg)*)));
48+
}
49+
2950
/// serial_print! prints to the host through
3051
/// the serial interface.
3152
///

kernel/src/vga_buffer.rs

Lines changed: 0 additions & 237 deletions
This file was deleted.

0 commit comments

Comments
 (0)