On Thu, 2022-12-01 at 14:46 +0100, Emanuele Giuseppe Esposito wrote: > > Am 22/11/2022 um 17:11 schrieb Maxim Levitsky: > > Add a simple test that a shutdown in L2 is intercepted > > correctly by the L1. > > > > Signed-off-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx> > > --- > > x86/svm_tests.c | 17 +++++++++++++++++ > > 1 file changed, 17 insertions(+) > > > > diff --git a/x86/svm_tests.c b/x86/svm_tests.c > > index a7641fb8..7a67132a 100644 > > --- a/x86/svm_tests.c > > +++ b/x86/svm_tests.c > > @@ -11,6 +11,7 @@ > > #include "apic.h" > > #include "delay.h" > > #include "x86/usermode.h" > > +#include "vmalloc.h" > > > > #define SVM_EXIT_MAX_DR_INTERCEPT 0x3f > > > > @@ -3238,6 +3239,21 @@ static void svm_exception_test(void) > > } > > } > > > > +static void shutdown_intercept_test_guest(struct svm_test *test) > > +{ > > + asm volatile ("ud2"); > > + report_fail("should not reach here\n"); > > + > Remove empty line here Will do, Best regards, Maxim Levitsky > > +}Add empty line here > > +static void svm_shutdown_intercept_test(void) > > +{ > > + test_set_guest(shutdown_intercept_test_guest); > > + vmcb->save.idtr.base = (u64)alloc_vpage(); > > + vmcb->control.intercept |= (1ULL << INTERCEPT_SHUTDOWN); > > + svm_vmrun(); > > + report(vmcb->control.exit_code == SVM_EXIT_SHUTDOWN, "shutdown test passed"); > > +} > > +