Run rustfmt

This commit is contained in:
Philipp Oppermann
2018-06-18 21:17:52 +02:00
parent 0b6174ace6
commit 22bf95ac19
4 changed files with 19 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ use core::panic::PanicInfo;
pub extern "C" fn _start() -> ! {
blog_os::gdt::init();
init_idt();
fn stack_overflow() {
stack_overflow(); // for each recursion, the return address is pushed
}
@@ -52,14 +52,14 @@ pub fn panic(info: &PanicInfo) -> ! {
loop {}
}
use x86_64::structures::idt::{ExceptionStackFrame, Idt};
lazy_static! {
static ref IDT: Idt = {
let mut idt = Idt::new();
unsafe {
idt.double_fault.set_handler_fn(double_fault_handler)
idt.double_fault
.set_handler_fn(double_fault_handler)
.set_stack_index(blog_os::gdt::DOUBLE_FAULT_IST_INDEX);
}
@@ -72,8 +72,9 @@ pub fn init_idt() {
}
extern "x86-interrupt" fn double_fault_handler(
_stack_frame: &mut ExceptionStackFrame, _error_code: u64)
{
_stack_frame: &mut ExceptionStackFrame,
_error_code: u64,
) {
serial_println!("ok");
unsafe {

View File

@@ -17,12 +17,17 @@ lazy_static! {
};
tss
};
static ref GDT: (GlobalDescriptorTable, Selectors) = {
let mut gdt = GlobalDescriptorTable::new();
let code_selector = gdt.add_entry(Descriptor::kernel_code_segment());
let tss_selector = gdt.add_entry(Descriptor::tss_segment(&TSS));
(gdt, Selectors { code_selector, tss_selector })
(
gdt,
Selectors {
code_selector,
tss_selector,
},
)
};
}

View File

@@ -13,9 +13,9 @@ extern crate array_init;
#[cfg(test)]
extern crate std;
pub mod gdt;
pub mod serial;
pub mod vga_buffer;
pub mod gdt;
pub unsafe fn exit_qemu() {
use x86_64::instructions::port::Port;

View File

@@ -49,7 +49,8 @@ lazy_static! {
let mut idt = Idt::new();
idt.breakpoint.set_handler_fn(breakpoint_handler);
unsafe {
idt.double_fault.set_handler_fn(double_fault_handler)
idt.double_fault
.set_handler_fn(double_fault_handler)
.set_stack_index(blog_os::gdt::DOUBLE_FAULT_IST_INDEX);
}
@@ -66,8 +67,9 @@ extern "x86-interrupt" fn breakpoint_handler(stack_frame: &mut ExceptionStackFra
}
extern "x86-interrupt" fn double_fault_handler(
stack_frame: &mut ExceptionStackFrame, _error_code: u64)
{
stack_frame: &mut ExceptionStackFrame,
_error_code: u64,
) {
println!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
loop {}
}