Skip to main content

kernel/arch/x86_64/interrupts/exceptions/
_29_vmm_communication_exception.rs

1// SPDX-License-Identifier: GPL-3.0-only
2//! VMM communication exception handler (vector 29, `#VC`, AMD SVM).
3//!
4//! Authors: MarioS271
5
6use core::fmt::Write;
7use x86_64::structures::idt::InterruptStackFrame;
8use crate::types::fmt_buffer::FmtBuffer;
9use crate::panic::kernel_panic;
10use crate::types::panic_codes::PanicCode;
11
12/// Panic with the error code and interrupt stack frame.
13pub extern "x86-interrupt" fn handler(
14    isf: InterruptStackFrame, error_code: u64
15) {
16    let mut fmt_buffer = FmtBuffer::<512>::new();
17    let _ = write!(&mut fmt_buffer, "Error Code: {}\n{:#?}\n", error_code, isf);
18    kernel_panic(
19        PanicCode::VmmCommunicationException,
20        fmt_buffer.as_str(),
21    );
22}