Get things to run under linux, also fix serial console

This commit is contained in:
guillaume didier 2019-11-12 18:04:11 +01:00
parent 7a437024f8
commit 578904198c
4 changed files with 24 additions and 12 deletions

View File

@ -1 +1,2 @@
nightly-2019-09-28
nightly

View File

@ -16,7 +16,7 @@
# 'usb_ehci', 'usb_ohci', 'usb_uhci', 'usb_xhci' and 'voodoo'.
#=======================================================================
#plugin_ctrl: unmapped=0, e1000=1 # unload 'unmapped' and load 'e1000'
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1
plugin_ctrl: unmapped=1, biosdev=1, speaker=0, extfpuirq=1, parallel=1, serial=1
#=======================================================================
# CONFIG_INTERFACE
#
@ -34,7 +34,7 @@ plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1
# NOTE: if you use the "wx" configuration interface, you must also use
# the "wx" display library.
#=======================================================================
config_interface: textconfig
#config_interface: textconfig
#config_interface: win32config
#config_interface: wx
@ -91,7 +91,7 @@ config_interface: textconfig
#display_library: win32
#display_library: wx
#display_library: x
#display_library: gui_debug
display_library: x, options="gui_debug"
#=======================================================================
# CPU:
@ -185,7 +185,7 @@ config_interface: textconfig
# 2.2.6 2.6Ghz Intel Core 2 Duo with WinXP/g++ 3.4 21 to 25 Mips
# 2.2.6 2.1Ghz Athlon XP with Linux 2.6/g++ 3.4 12 to 15 Mips
#=======================================================================
cpu: model=ryzen, count=1,, reset_on_triple_fault=0
cpu: model=corei7_sandy_bridge_2600k, count=1, ips=50000000, reset_on_triple_fault=0
#=======================================================================
# CPUID:
@ -857,7 +857,7 @@ debugger_log: -
# com4: enabled=1, mode=pipe-client, dev=\\.\pipe\mypipe
# com4: enabled=1, mode=pipe-server, dev=\\.\pipe\mypipe
#=======================================================================
com1: enabled=1, mode=term, dev=/dev/stdin
com1: enabled=1, mode=socket-server, dev=127.0.0.1:8000
#=======================================================================

View File

@ -60,6 +60,7 @@ extern "x86-interrupt" fn double_fault_handler(sf: &mut InterruptStackFrame, e:
}
use x86_64::structures::idt::PageFaultErrorCode;
use x86_64::instructions::bochs_breakpoint;
extern "x86-interrupt" fn page_fault_handler(sf: &mut InterruptStackFrame, e: PageFaultErrorCode) {
// LLVM bug causing misaligned stacks when error codes are present.
@ -76,9 +77,13 @@ extern "x86-interrupt" fn page_fault_handler(sf: &mut InterruptStackFrame, e: Pa
error_code = *(&e as *const PageFaultErrorCode).offset(1) as PageFaultErrorCode;
}
println!("EXCEPTION: PAGE FAULT");
println!("Accessed Address: {:?}", Cr2::read());
println!("Error Code: {:?}", error_code);
println!("{:#?}", stack_frame);
serial_println!("EXCEPTION: PAGE FAULT");
serial_println!("Accessed Address: {:?}", Cr2::read());
serial_println!("Error Code: {:?}", error_code);
serial_println!("{:#?}", stack_frame);
serial_println!("Halting...");
bochs_breakpoint();
hlt_loop();
}

View File

@ -43,7 +43,7 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
#[cfg(test)]
test_main();
println!("Preparing nasty fault...");
x86_64::instructions::interrupts::int3();
@ -55,12 +55,18 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
level_4_page_table.start_address(),
flags
);
serial_println!(
"Level 4 page table at: {:?}, flags {:?}",
level_4_page_table.start_address(),
flags
);
serial_println!("Preparing nasty fault...");
unsafe {
*(0xdeadbeef as *mut u64) = 42;
}
println!("Survived ? oO");
serial_println!("Survived ? oO");
// magic break ?
// x86_64::instructions::bochs_breakpoint();