Re: [kvm-unit-tests PATCH 3/3] x86: Add test coverage for the routing logic when exceptions occur in L2

Aaron Lewis
2021-12-14T01:19:14Z

> Having a gigantic asm blob is also unnecessary. #GP can be generated with a
> non-canonical access purely in C. Ditto for #AC though that may or may not be
> more readable. #DE probably requires assembly to avoid compiler intervention.

For #AC I'd prefer to leave this in ASM. To get this to work in C I
had to trick the compiler to not optimize the code away and when I was
playing with it in compiler explorer clang seemed to outsmart my
unaligning access with an aligned one which defeated the purpose. It
seems more reliable for what I want to leave it in ASM.

> #UD and #BP should be short and sweet. E.g.
>
> It should be fairly straightforward to create a framework to handle running each
> test, a la the vmx_tests array. E.g. something like the below (completely untested).
> This way there's no need to skip instructions, thus no need for a exposing a bunch