diff --git a/polling_serial/src/lib.rs b/polling_serial/src/lib.rs index c607603..6e08080 100644 --- a/polling_serial/src/lib.rs +++ b/polling_serial/src/lib.rs @@ -34,7 +34,7 @@ pub struct SerialPort { line_status: Port, // 5 /// Modem Status Register. - modem_status: Port, // 6 + //modem_status: Port, // 6 /// Scratch Register. scratch: Port, // 7 @@ -70,7 +70,7 @@ impl SerialPort { line_ctrl: Port::new(base + 3), modem_ctrl: Port::new(base + 4), line_status: Port::new(base + 5), - modem_status: Port::new(base + 6), + //modem_status: Port::new(base + 6), scratch: Port::new(base + 7), }; @@ -139,7 +139,7 @@ impl fmt::Write for SerialPort { lazy_static! { pub static ref SERIAL1: Mutex = { - let mut serial_port = unsafe { SerialPort::init_new(0x3F8).unwrap() }; + let serial_port = unsafe { SerialPort::init_new(0x3F8).unwrap() }; Mutex::new(serial_port) }; } diff --git a/src/gdt.rs b/src/gdt.rs index 7960604..cd11171 100644 --- a/src/gdt.rs +++ b/src/gdt.rs @@ -18,8 +18,7 @@ lazy_static! { static mut STACK: [u8; STACK_SIZE] = [0; STACK_SIZE]; let stack_start = VirtAddr::from_ptr(unsafe { &STACK }); // FIXME once we have page allocation available. - let stack_end = stack_start + STACK_SIZE; - stack_end + stack_start + STACK_SIZE }; tss }; diff --git a/src/interrupts.rs b/src/interrupts.rs index e709eee..b320435 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -4,7 +4,7 @@ use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; use crate::gdt; use crate::hlt_loop; use polling_serial::serial_println; -use vga_buffer::{print, println, set_colors, Color, ForegroundColor}; +use vga_buffer::println; lazy_static! { static ref IDT: InterruptDescriptorTable = { @@ -40,7 +40,7 @@ extern "x86-interrupt" fn double_fault_handler(sf: &mut InterruptStackFrame, e: unsafe { asm!("push rax" :::: "intel"); - let s = (sf as *mut InterruptStackFrame); + let s = sf as *mut InterruptStackFrame; stack_frame = &mut *((s as *mut u64).offset(1) as *mut InterruptStackFrame); error_code = *(&e as *const u64).offset(1); } @@ -72,7 +72,7 @@ extern "x86-interrupt" fn page_fault_handler(sf: &mut InterruptStackFrame, e: Pa unsafe { asm!("push rax" :::: "intel"); - let s = (sf as *mut InterruptStackFrame); + let s = sf as *mut InterruptStackFrame; stack_frame = &mut *((s as *mut u64).offset(1) as *mut InterruptStackFrame); error_code = *(&e as *const PageFaultErrorCode).offset(1) as PageFaultErrorCode; } diff --git a/src/lib.rs b/src/lib.rs index 03ca0a8..55d4950 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,8 +8,8 @@ use core::panic::PanicInfo; -use polling_serial::{serial_print, serial_println}; -use vga_buffer::{print, println}; +use polling_serial::serial_println; +use vga_buffer::println; use x86_64::instructions::bochs_breakpoint; pub mod gdt; @@ -38,7 +38,9 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { let mut port = Port::new(0xf4); port.write(exit_code as u32); } - loop {} + loop { + bochs_breakpoint(); + } } pub fn test_runner(tests: &[&dyn Fn()]) { @@ -89,6 +91,6 @@ fn trivial_assertion() { fn printf_test() { serial_print!("Testing VGA print/println... "); println!("Are frogs blue?"); - print!("Yes\n"); + println!("Yes"); serial_println!("[ok]"); } diff --git a/src/main.rs b/src/main.rs index 19bdb5a..cf7bf29 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,10 +7,9 @@ #![test_runner(dendrobates_tinctoreus_azureus::test_runner)] #![reexport_test_harness_main = "test_main"] -use polling_serial::{serial_print, serial_println}; -use vga_buffer::{print, println, set_colors, Color, ForegroundColor}; +use polling_serial::serial_println; +use vga_buffer::{println, set_colors, Color, ForegroundColor}; -use core::fmt::Write; use core::panic::PanicInfo; use vga_buffer; // required for custom panic handler @@ -63,7 +62,7 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! { serial_println!("Preparing nasty fault..."); unsafe { - *(0xdeadbeef as *mut u64) = 42; + *(0xdead_beef as *mut u64) = 42; } serial_println!("Survived ? oO"); diff --git a/tests/stack_overflow.rs b/tests/stack_overflow.rs index 7fd06e3..bc430b1 100644 --- a/tests/stack_overflow.rs +++ b/tests/stack_overflow.rs @@ -57,17 +57,16 @@ use x86_64::structures::idt::InterruptStackFrame; extern "x86-interrupt" fn test_double_fault_handler(sf: &mut InterruptStackFrame, e: u64) { // LLVM bug causing misaligned stacks when error codes are present. // This code realigns the stack and then grabs the correct values by doing some pointer arithmetic - let stack_frame: &mut InterruptStackFrame; - let error_code: u64; + let _stack_frame: &mut InterruptStackFrame; + let _error_code: u64; unsafe { asm!("push rax" :::: "intel"); - let s = (sf as *mut InterruptStackFrame); - stack_frame = &mut *((s as *mut u64).offset(1) as *mut InterruptStackFrame); - error_code = *(&e as *const u64).offset(1); + let s = sf as *mut InterruptStackFrame; + _stack_frame = &mut *((s as *mut u64).offset(1) as *mut InterruptStackFrame); + _error_code = *(&e as *const u64).offset(1); } // End Hack serial_println!("[ok]"); exit_qemu(QemuExitCode::Success); - loop {} } diff --git a/vga_buffer/src/lib.rs b/vga_buffer/src/lib.rs index 412fd3d..9656b41 100644 --- a/vga_buffer/src/lib.rs +++ b/vga_buffer/src/lib.rs @@ -116,8 +116,8 @@ impl Writer { let mut w = Writer { column_position: 0, row_position: 0, - color_code: color_code, - buffer: buffer, + color_code, + buffer, }; w.clear_screen(); w