summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/.gitignore
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-11-02 11:46:52 -0700
committerSean Christopherson <seanjc@google.com>2022-11-16 16:59:01 -0800
commitb9635930f0a73c1ef7b465121896c3fb2e3b77cd (patch)
treef4d66b0836d9059226fbf9e99320c4a8d45facf0 /tools/testing/selftests/kvm/.gitignore
parentf2e5b53b4ba9bc10d3febc3682bdf22e946bf6eb (diff)
KVM: selftests: Provide error code as a KVM_ASM_SAFE() output
Provide the error code on a fault in KVM_ASM_SAFE(), e.g. to allow tests to assert that #PF generates the correct error code without needing to manually install a #PF handler. Use r10 as the scratch register for the error code, as it's already clobbered by the asm blob (loaded with the RIP of the to-be-executed instruction). Deliberately load the output "error_code" even in the non-faulting path so that error_code is always initialized with deterministic data (the aforementioned RIP), i.e to ensure a selftest won't end up with uninitialized consumption regardless of how KVM_ASM_SAFE() is used. Don't clear r10 in the non-faulting case and instead load error code with the RIP (see above). The error code is valid if and only if an exception occurs, and '0' isn't necessarily a better "invalid" value, e.g. '0' could result in false passes for a buggy test. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20221102184654.282799-9-dmatlack@google.com
Diffstat (limited to 'tools/testing/selftests/kvm/.gitignore')
0 files changed, 0 insertions, 0 deletions