Skip to content

Commit 9f2e615

Browse files
committed
Add missing IDT entry #CP (vector 21)
Currently the InterruptDescriptorTable is missing entry with vector number 21, #CP. More information at AMD's APM Volume 2, subsection 8.2.20. See issue #378. Signed-off-by: Carlos Bilbao <[email protected]>
1 parent 2f2eaf6 commit 9f2e615

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/structures/idt.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,20 @@ pub struct InterruptDescriptorTable {
340340
/// vector nr. 20
341341
pub virtualization: Entry<HandlerFunc>,
342342

343-
/// vector nr. 21-27
344-
reserved_2: [Entry<HandlerFunc>; 7],
343+
/// A #CP exception is generated when shadow stacks are enabled and mismatch
344+
/// scenarios are detected (possible error code cases below).
345+
///
346+
/// The error code is the #CP error code, for each of the following situations:
347+
/// - A RET (near) instruction encountered a return address mismatch.
348+
/// - A RET (far) instruction encountered a return address mismatch.
349+
/// - A RSTORSSP instruction encountered an invalid shadow stack restore token.
350+
/// - A SETSSBY instruction encountered an invalid supervisor shadow stack token.
351+
///
352+
/// vector nr. 21
353+
pub cp_protection_exception: Entry<HandlerFuncWithErrorCode>,
354+
355+
/// vector nr. 22-27
356+
reserved_2: [Entry<HandlerFunc>; 6],
345357

346358
/// The Hypervisor Injection Exception (`#HV`) is injected by a hypervisor
347359
/// as a doorbell to inform an `SEV-SNP` enabled guest running with the
@@ -453,7 +465,8 @@ impl InterruptDescriptorTable {
453465
machine_check: Entry::missing(),
454466
simd_floating_point: Entry::missing(),
455467
virtualization: Entry::missing(),
456-
reserved_2: [Entry::missing(); 7],
468+
cp_protection_exception: Entry::missing(),
469+
reserved_2: [Entry::missing(); 6],
457470
hv_injection_exception: Entry::missing(),
458471
vmm_communication_exception: Entry::missing(),
459472
security_exception: Entry::missing(),

0 commit comments

Comments
 (0)