Commit 40e19b51 authored by Avi Kivity's avatar Avi Kivity

KVM: SVM: Get rid of x86_intercept_map::valid

By reserving 0 as an invalid x86_intercept_stage, we no longer
need to store a valid flag in x86_intercept_map.
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 5ef39c71
...@@ -304,6 +304,7 @@ struct x86_emulate_ctxt { ...@@ -304,6 +304,7 @@ struct x86_emulate_ctxt {
X86EMUL_MODE_PROT64) X86EMUL_MODE_PROT64)
enum x86_intercept_stage { enum x86_intercept_stage {
X86_ICTP_NONE = 0, /* Allow zero-init to not match anything */
X86_ICPT_PRE_EXCEPT, X86_ICPT_PRE_EXCEPT,
X86_ICPT_POST_EXCEPT, X86_ICPT_POST_EXCEPT,
X86_ICPT_POST_MEMACCESS, X86_ICPT_POST_MEMACCESS,
......
...@@ -3959,19 +3959,15 @@ static void svm_fpu_deactivate(struct kvm_vcpu *vcpu) ...@@ -3959,19 +3959,15 @@ static void svm_fpu_deactivate(struct kvm_vcpu *vcpu)
} }
#define PRE_EX(exit) { .exit_code = (exit), \ #define PRE_EX(exit) { .exit_code = (exit), \
.stage = X86_ICPT_PRE_EXCEPT, \ .stage = X86_ICPT_PRE_EXCEPT, }
.valid = true }
#define POST_EX(exit) { .exit_code = (exit), \ #define POST_EX(exit) { .exit_code = (exit), \
.stage = X86_ICPT_POST_EXCEPT, \ .stage = X86_ICPT_POST_EXCEPT, }
.valid = true }
#define POST_MEM(exit) { .exit_code = (exit), \ #define POST_MEM(exit) { .exit_code = (exit), \
.stage = X86_ICPT_POST_MEMACCESS, \ .stage = X86_ICPT_POST_MEMACCESS, }
.valid = true }
static struct __x86_intercept { static struct __x86_intercept {
u32 exit_code; u32 exit_code;
enum x86_intercept_stage stage; enum x86_intercept_stage stage;
bool valid;
} x86_intercept_map[] = { } x86_intercept_map[] = {
[x86_intercept_cr_read] = POST_EX(SVM_EXIT_READ_CR0), [x86_intercept_cr_read] = POST_EX(SVM_EXIT_READ_CR0),
[x86_intercept_cr_write] = POST_EX(SVM_EXIT_WRITE_CR0), [x86_intercept_cr_write] = POST_EX(SVM_EXIT_WRITE_CR0),
...@@ -4039,7 +4035,7 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu, ...@@ -4039,7 +4035,7 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu,
icpt_info = x86_intercept_map[info->intercept]; icpt_info = x86_intercept_map[info->intercept];
if (!icpt_info.valid || stage != icpt_info.stage) if (stage != icpt_info.stage)
goto out; goto out;
switch (icpt_info.exit_code) { switch (icpt_info.exit_code) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment