Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
Fix exception spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanPlant committed Feb 13, 2024
1 parent bacf4e4 commit 4af51a3
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 52 deletions.
18 changes: 0 additions & 18 deletions charlotte_core/src/arch/x86_64/exceptions/exceptions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,13 @@ isr_segment_not_present:
add rsp, 8 ; Clean up the error code from the stack
iretq


global isr_debug
isr_debug:
call save_regs
call ih_debug
call restore_regs
iretq



global isr_non_maskable_interrupt
isr_non_maskable_interrupt:
call save_regs
Expand All @@ -141,31 +138,27 @@ isr_overflow:
call restore_regs
iretq


global isr_bound_range_exceeded
isr_bound_range_exceeded:
call save_regs
call ih_bound_range_exceeded
call restore_regs
iretq


global isr_invalid_opcode
isr_invalid_opcode:
call save_regs
call ih_invalid_opcode
call restore_regs
iretq


global isr_device_not_available
isr_device_not_available:
call save_regs
call ih_device_not_available
call restore_regs
iretq


global isr_invalid_tss
isr_invalid_tss:
call save_regs
Expand All @@ -176,7 +169,6 @@ isr_invalid_tss:
add rsp, 8
iretq


global isr_stack_segment_fault
isr_stack_segment_fault:
call save_regs
Expand All @@ -187,7 +179,6 @@ isr_stack_segment_fault:
add rsp, 8
iretq


global isr_reserved
isr_reserved:
call save_regs
Expand All @@ -196,15 +187,13 @@ isr_reserved:
call restore_regs
iretq


global isr_x87_floating_point
isr_x87_floating_point:
call save_regs
call ih_x87_floating_point
call restore_regs
iretq


global isr_alignment_check
isr_alignment_check:
call save_regs
Expand All @@ -215,31 +204,27 @@ isr_alignment_check:
add rsp, 8
iretq


global isr_machine_check
isr_machine_check:
; Registers are not saved since this exception is an abort
; Unlike Double Fault, Machine Check does not push an error code
call ih_machine_check
hlt ; Halt the core since machine checks indicate severe hardware issues


global isr_simd_floating_point
isr_simd_floating_point:
call save_regs
call ih_simd_floating_point
call restore_regs
iretq


global isr_virtualization
isr_virtualization:
call save_regs
call ih_virtualization
call restore_regs
iretq


global isr_control_protection
isr_control_protection:
call save_regs
Expand All @@ -250,15 +235,13 @@ isr_control_protection:
add rsp, 8
iretq


global isr_hypervisor_injection
isr_hypervisor_injection:
call save_regs
call ih_hypervisor_injection
call restore_regs
iretq


global isr_vmm_communication
isr_vmm_communication:
call save_regs
Expand All @@ -269,7 +252,6 @@ isr_vmm_communication:
add rsp, 8 ; Clean up the error code from the stack
iretq


global isr_security_exception
isr_security_exception:
call save_regs
Expand Down
20 changes: 0 additions & 20 deletions charlotte_core/src/arch/x86_64/exceptions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub fn load_exceptions(idt: &mut Idt) {
idt.set_gate(28, isr_hypervisor_injection, 1 << 3, true, false);
idt.set_gate(29, isr_vmm_communication, 1 << 3, true, false);
idt.set_gate(30, isr_security_exception, 1 << 3, true, false);

}

extern "C" {
Expand Down Expand Up @@ -101,7 +100,6 @@ extern "C" fn ih_page_fault(error_code: u64) {
.ignore();
}


#[no_mangle]
extern "C" fn ih_segment_not_present(error_code: u64) {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -114,7 +112,6 @@ extern "C" fn ih_segment_not_present(error_code: u64) {
.ignore();
}


#[no_mangle]
extern "C" fn ih_debug() {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -135,7 +132,6 @@ extern "C" fn ih_non_maskable_interrupt() {
).ignore();
}


#[no_mangle]
extern "C" fn ih_breakpoint() {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -156,7 +152,6 @@ extern "C" fn ih_overflow() {
).ignore();
}


#[no_mangle]
extern "C" fn ih_bound_range_exceeded() {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -167,7 +162,6 @@ extern "C" fn ih_bound_range_exceeded() {
).ignore();
}


#[no_mangle]
extern "C" fn ih_invalid_opcode() {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -178,7 +172,6 @@ extern "C" fn ih_invalid_opcode() {
).ignore();
}


#[no_mangle]
extern "C" fn ih_device_not_available() {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -189,7 +182,6 @@ extern "C" fn ih_device_not_available() {
).ignore();
}


#[no_mangle]
extern "C" fn ih_invalid_tss(error_code: u64) {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -201,7 +193,6 @@ extern "C" fn ih_invalid_tss(error_code: u64) {
).ignore();
}


#[no_mangle]
extern "C" fn ih_stack_segment_fault(error_code: u64) {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -213,7 +204,6 @@ extern "C" fn ih_stack_segment_fault(error_code: u64) {
).ignore();
}


#[no_mangle]
extern "C" fn ih_reserved() {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -224,8 +214,6 @@ extern "C" fn ih_reserved() {
).ignore();
}



#[no_mangle]
extern "C" fn ih_x87_floating_point() {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -236,7 +224,6 @@ extern "C" fn ih_x87_floating_point() {
).ignore();
}


#[no_mangle]
extern "C" fn ih_alignment_check(error_code: u64) {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -248,7 +235,6 @@ extern "C" fn ih_alignment_check(error_code: u64) {
).ignore();
}


#[no_mangle]
extern "C" fn ih_machine_check() {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -270,7 +256,6 @@ extern "C" fn ih_simd_floating_point() {
).ignore();
}


#[no_mangle]
extern "C" fn ih_virtualization() {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -281,7 +266,6 @@ extern "C" fn ih_virtualization() {
).ignore();
}


#[no_mangle]
extern "C" fn ih_control_protection(error_code: u64) {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -303,7 +287,6 @@ extern "C" fn ih_hypervisor_injection() {
).ignore();
}


#[no_mangle]
extern "C" fn ih_vmm_communication(error_code: u64) {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand All @@ -315,9 +298,6 @@ extern "C" fn ih_vmm_communication(error_code: u64) {
).ignore();
}




#[no_mangle]
extern "C" fn ih_security_exception(error_code: u64) {
let mut logger = SerialPort::try_new(COM1).unwrap();
Expand Down
15 changes: 1 addition & 14 deletions charlotte_core/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#![feature(slice_internals)]



mod access_control;
mod arch;
mod framebuffer;
Expand Down Expand Up @@ -33,18 +31,6 @@ unsafe extern "C" fn main() -> ! {
ArchApi::init_bsp();
write!(&mut logger, "BSP Initialized\n").unwrap();

// write!(&mut logger, "Testing double fault\n").unwrap();
// asm!("int 8");
// write!(&mut logger, "Double fault test passed\n").unwrap();

write!(&mut logger, "Testing divide by zero\n").unwrap();
asm!("int 0");
write!(&mut logger, "Divide by zero test passed\n").unwrap();

// write!(&mut logger, "Testing GP fault\n").unwrap();
// asm!("int 13");
// write!(&mut logger, "GP fault test passed\n").unwrap();

write!(&mut logger, "All tests in main passed.\n").unwrap();

writeln!(
Expand All @@ -53,6 +39,7 @@ unsafe extern "C" fn main() -> ! {
ArchApi::get_paddr_width()
)
.unwrap();

writeln!(
&mut logger,
"Number of Significant Virtual Address Bits Supported: {}",
Expand Down

0 comments on commit 4af51a3

Please sign in to comment.