Skip to content

Commit b2b82af

Browse files
committed
IDT: Update set_general_handler_entry! for #HV and #CP
Add the following changes to macro set_general_handler_entry! to account for the newly added vector entries: For #HV (vector 28) we need to remove the empty arm. For #CP (vector 21) we need to remove the empty arm, and include a new arm. Signed-off-by: Carlos Bilbao <[email protected]>
1 parent 1e9af54 commit b2b82af

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/structures/idt.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,15 @@ macro_rules! set_general_handler_entry {
13231323
}
13241324
$idt.machine_check.set_handler_fn(handler);
13251325
}};
1326+
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 0, 1, 0, 1) => {{
1327+
extern "x86-interrupt" fn handler(
1328+
frame: $crate::structures::idt::InterruptStackFrame,
1329+
error_code: u64,
1330+
) {
1331+
$handler(frame, $idx.into(), Some(error_code));
1332+
}
1333+
$idt.cp_protection_exception.set_handler_fn(handler);
1334+
}};
13261335
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 1, 1, 0, 1) => {
13271336
extern "x86-interrupt" fn handler(
13281337
frame: $crate::structures::idt::InterruptStackFrame,
@@ -1345,14 +1354,12 @@ macro_rules! set_general_handler_entry {
13451354
// reserved_1
13461355
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 0, 1, 1, 1, 1) => {};
13471356
// reserved_2
1348-
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 0, 1, 0, 1) => {};
13491357
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 0, 1, 1, 0) => {};
13501358
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 0, 1, 1, 1) => {};
13511359
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 1, 0, 0, 0) => {};
13521360
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 1, 0, 0, 1) => {};
13531361
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 1, 0, 1, 0) => {};
13541362
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 1, 0, 1, 1) => {};
1355-
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 1, 1, 0, 0) => {};
13561363
// reserved_3
13571364
($idt:expr, $handler:ident, $idx:ident, 0, 0, 0, 1, 1, 1, 1, 1) => {};
13581365

0 commit comments

Comments
 (0)