@@ -100,6 +100,8 @@ static int exit_invalid_guest_state(struct vcpu_t *vcpu,
100
100
static int exit_ept_misconfiguration (struct vcpu_t * vcpu ,
101
101
struct hax_tunnel * htun );
102
102
static int exit_ept_violation (struct vcpu_t * vcpu , struct hax_tunnel * htun );
103
+ static int exit_unsupported_instruction (struct vcpu_t * vcpu ,
104
+ struct hax_tunnel * htun );
103
105
static int null_handler (struct vcpu_t * vcpu , struct hax_tunnel * hun );
104
106
105
107
static void advance_rip (struct vcpu_t * vcpu );
@@ -388,6 +390,22 @@ static int (*handler_funcs[])(struct vcpu_t *vcpu, struct hax_tunnel *htun) = {
388
390
[VMX_EXIT_FAILED_VMENTER_GS ] = exit_invalid_guest_state ,
389
391
[VMX_EXIT_EPT_VIOLATION ] = exit_ept_violation ,
390
392
[VMX_EXIT_EPT_MISCONFIG ] = exit_ept_misconfiguration ,
393
+ [VMX_EXIT_GETSEC ] = exit_unsupported_instruction ,
394
+ [VMX_EXIT_INVD ] = exit_unsupported_instruction ,
395
+ [VMX_EXIT_VMCALL ] = exit_unsupported_instruction ,
396
+ [VMX_EXIT_VMCLEAR ] = exit_unsupported_instruction ,
397
+ [VMX_EXIT_VMLAUNCH ] = exit_unsupported_instruction ,
398
+ [VMX_EXIT_VMPTRLD ] = exit_unsupported_instruction ,
399
+ [VMX_EXIT_VMPTRST ] = exit_unsupported_instruction ,
400
+ //VMREAD and VMWRITE vm-exits are conditional. When "VMCS shadowing" bit
401
+ //in secondary CPU VM-execution control is 0, these exit. This condition
402
+ //holds in haxm.
403
+ [VMX_EXIT_VMREAD ] = exit_unsupported_instruction ,
404
+ [VMX_EXIT_VMWRITE ] = exit_unsupported_instruction ,
405
+ [VMX_EXIT_VMRESUME ] = exit_unsupported_instruction ,
406
+ [VMX_EXIT_VMXOFF ] = exit_unsupported_instruction ,
407
+ [VMX_EXIT_VMXON ] = exit_unsupported_instruction ,
408
+ [VMX_EXIT_XSETBV ] = exit_unsupported_instruction ,
391
409
};
392
410
393
411
static int nr_handlers = ARRAY_ELEMENTS (handler_funcs );
@@ -3882,6 +3900,13 @@ static int exit_ept_violation(struct vcpu_t *vcpu, struct hax_tunnel *htun)
3882
3900
return vcpu_emulate_insn (vcpu );
3883
3901
}
3884
3902
3903
+ static int exit_unsupported_instruction (struct vcpu_t * vcpu ,
3904
+ struct hax_tunnel * htun )
3905
+ {
3906
+ hax_inject_exception (vcpu , VECTOR_UD , NO_ERROR_CODE );
3907
+ return HAX_RESUME ;
3908
+ }
3909
+
3885
3910
static void handle_mem_fault (struct vcpu_t * vcpu , struct hax_tunnel * htun )
3886
3911
{
3887
3912
hax_log (HAX_LOGW ,
0 commit comments