@@ -51,11 +51,6 @@ struct descriptor_table_ptr gdt_descr = {
.base = (unsigned long)gdt,
};
-#ifndef __x86_64__
-__attribute__((regparm(1)))
-#endif
-void do_handle_exception(struct ex_regs *regs);
-
void set_idt_entry(int vec, void *addr, int dpl)
{
idt_entry_t *e = &boot_idt[vec];
@@ -222,6 +222,10 @@ unsigned exception_vector(void);
int write_cr4_checking(unsigned long val);
unsigned exception_error_code(void);
bool exception_rflags_rf(void);
+#ifndef __x86_64__
+__attribute__((regparm(1)))
+#endif
+void do_handle_exception(struct ex_regs *regs);
void set_idt_entry(int vec, void *addr, int dpl);
void set_idt_sel(int vec, u16 sel);
void set_idt_dpl(int vec, u16 dpl);
@@ -365,8 +365,15 @@ static bool tdx_handle_virtualization_exception(struct ex_regs *regs,
}
/* After successful #VE handling, move the IP */
- if (ret)
+ if (ret) {
regs->rip += ve->instr_len;
+ /* Simulate single step on simulated instruction */
+ if (regs->rflags & X86_EFLAGS_TF) {
+ regs->vector = DB_VECTOR;
+ write_dr6(read_dr6() | (1 << 14));
+ do_handle_exception(regs);
+ }
+ }
else
ret = tdx_check_exception_table(regs);