Skip to content

Commit a326c55

Browse files
committed
Removed serial_print{ln}, now print{ln} does the same thing
Signed-off-by: SlyMarbo <[email protected]>
1 parent ea2ee35 commit a326c55

File tree

4 files changed

+12
-33
lines changed

4 files changed

+12
-33
lines changed

kernel/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ where
7373
T: Fn(),
7474
{
7575
fn run(&self) {
76-
serial_print!("{}...\t", core::any::type_name::<T>());
76+
print!("{}...\t", core::any::type_name::<T>());
7777
self();
78-
serial_println!("[ok]");
78+
println!("[ok]");
7979
}
8080
}
8181

8282
/// Entry point for the set of unit
8383
/// tests.
8484
///
8585
pub fn test_runner(tests: &[&dyn Testable]) {
86-
serial_println!("Running {} tests", tests.len());
86+
println!("Running {} tests", tests.len());
8787
for test in tests {
8888
test.run();
8989
}
@@ -94,8 +94,8 @@ pub fn test_runner(tests: &[&dyn Testable]) {
9494
/// Panic handler for tests.
9595
///
9696
pub fn test_panic_handler(info: &PanicInfo) -> ! {
97-
serial_println!("[failed]\n");
98-
serial_println!("Error: {}\n", info);
97+
println!("[failed]\n");
98+
println!("Error: {}\n", info);
9999
exit_qemu(QemuExitCode::Failed);
100100
halt_loop();
101101
}

kernel/src/serial.rs

-21
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,3 @@ macro_rules! println {
4545
() => ($crate::print!("\n"));
4646
($($arg:tt)*) => ($crate::print!("{}\n", format_args!($($arg)*)));
4747
}
48-
49-
/// serial_print! prints to the host through
50-
/// the serial interface.
51-
///
52-
#[macro_export]
53-
macro_rules! serial_print {
54-
($($arg:tt)*) => {
55-
$crate::serial::_print(format_args!($($arg)*));
56-
};
57-
}
58-
59-
/// serial_println! prints to the host through
60-
/// the serial interface, appending a newline.
61-
///
62-
#[macro_export]
63-
macro_rules! serial_println {
64-
() => ($crate::serial_print!("\n"));
65-
($fmt:expr) => ($crate::serial_print!(concat!($fmt, "\n")));
66-
($fmt:expr, $($arg:tt)*) => ($crate::serial_print!(
67-
concat!($fmt, "\n"), $($arg)*));
68-
}

kernel/tests/should_panic.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
#![no_main]
33

44
use core::panic::PanicInfo;
5-
use kernel::{exit_qemu, serial_print, serial_println, QemuExitCode};
5+
use kernel::{exit_qemu, print, println, QemuExitCode};
66

77
// _start is the entry point.
88
#[no_mangle]
99
pub extern "C" fn _start() -> ! {
1010
should_fail();
11-
serial_println!("[test did not panic]");
11+
println!("[test did not panic]");
1212
exit_qemu(QemuExitCode::Failed);
1313
loop {}
1414
}
1515

1616
fn should_fail() {
17-
serial_print!("should_panic::should_fail...\t");
17+
print!("should_panic::should_fail...\t");
1818
assert_eq!(0, 1);
1919
}
2020

2121
#[panic_handler]
2222
fn panic(_info: &PanicInfo) -> ! {
23-
serial_println!("[ok]");
23+
println!("[ok]");
2424
exit_qemu(QemuExitCode::Success);
2525
loop {}
2626
}

kernel/tests/stack_overflow.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![feature(abi_x86_interrupt)]
44

55
use core::panic::PanicInfo;
6-
use kernel::{exit_qemu, serial_print, serial_println, QemuExitCode};
6+
use kernel::{exit_qemu, print, println, QemuExitCode};
77
use lazy_static::lazy_static;
88
use x86_64::structures::idt::InterruptDescriptorTable;
99
use x86_64::structures::idt::InterruptStackFrame;
@@ -12,7 +12,7 @@ extern "x86-interrupt" fn test_double_fault_handler(
1212
_stack_frame: &mut InterruptStackFrame,
1313
_error_code: u64,
1414
) -> ! {
15-
serial_println!("[ok]");
15+
println!("[ok]");
1616
exit_qemu(QemuExitCode::Success);
1717
loop {}
1818
}
@@ -36,7 +36,7 @@ pub fn init_test_idt() {
3636

3737
#[no_mangle]
3838
pub extern "C" fn _start() -> ! {
39-
serial_print!("stack_overflow::stack_overflow...\t");
39+
print!("stack_overflow::stack_overflow...\t");
4040

4141
kernel::gdt::init();
4242
init_test_idt();

0 commit comments

Comments
 (0)