Skip to content

Commit

Permalink
Merge pull request #159 from p4zuu/rm_handle_db_exception
Browse files Browse the repository at this point in the history
debug: remove handle_db_exception
  • Loading branch information
joergroedel authored Nov 23, 2023
2 parents 3f53bc2 + 87ac1a6 commit 6c088bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/cpu/vc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::idt::common::X86ExceptionContext;
use crate::cpu::cpuid::{cpuid_table_raw, CpuidLeaf};
use crate::cpu::insn::{insn_fetch, Instruction};
use crate::cpu::percpu::this_cpu_mut;
use crate::debug::gdbstub::svsm_gdbstub::handle_db_exception;
use crate::debug::gdbstub::svsm_gdbstub::handle_debug_exception;
use crate::error::SvsmError;
use crate::sev::ghcb::{GHCBIOSize, GHCB};
use core::fmt;
Expand Down Expand Up @@ -128,7 +128,7 @@ pub fn handle_vc_exception(ctx: &mut X86ExceptionContext) {
match error_code {
// If the debugger is enabled then handle the DB exception
// by directly invoking the exception handler
X86_TRAP_DB => handle_db_exception(ctx),
X86_TRAP_DB => handle_debug_exception(ctx, ctx.vector),
SVM_EXIT_CPUID => handle_cpuid(ctx).expect("Could not handle CPUID #VC exception"),
SVM_EXIT_IOIO => {
handle_ioio(ctx, ghcb, &insn).expect("Could not handle IOIO #VC exception")
Expand Down
7 changes: 2 additions & 5 deletions src/debug/gdbstub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub mod svsm_gdbstub {

use crate::address::{Address, VirtAddr};
use crate::cpu::control_regs::read_cr3;
use crate::cpu::idt::common::{X86ExceptionContext, BP_VECTOR};
use crate::cpu::idt::common::{X86ExceptionContext, BP_VECTOR, VC_VECTOR};
use crate::cpu::percpu::{this_cpu, this_cpu_mut};
use crate::cpu::X86GeneralRegs;
use crate::error::SvsmError;
Expand Down Expand Up @@ -72,15 +72,12 @@ pub mod svsm_gdbstub {
pub fn handle_debug_exception(ctx: &mut X86ExceptionContext, exception: usize) {
let tp = match exception {
BP_VECTOR => ExceptionType::SwBreakpoint,
VC_VECTOR => ExceptionType::Debug,
_ => ExceptionType::PageFault,
};
handle_exception(ctx, tp);
}

pub fn handle_db_exception(ctx: &mut X86ExceptionContext) {
handle_exception(ctx, ExceptionType::Debug);
}

fn handle_exception(ctx: &mut X86ExceptionContext, exception_type: ExceptionType) {
let id = this_cpu().runqueue().lock_read().current_task_id();
let mut task_ctx = TaskContext {
Expand Down

0 comments on commit 6c088bd

Please sign in to comment.