@@ -408,6 +408,26 @@ struct gprefix {
408408 (_eip) += (_size); \
409409})
410410
411+ static int emulator_check_intercept (struct x86_emulate_ctxt * ctxt ,
412+ enum x86_intercept intercept ,
413+ enum x86_intercept_stage stage )
414+ {
415+ struct x86_instruction_info info = {
416+ .intercept = intercept ,
417+ .rep_prefix = ctxt -> decode .rep_prefix ,
418+ .modrm_mod = ctxt -> decode .modrm_mod ,
419+ .modrm_reg = ctxt -> decode .modrm_reg ,
420+ .modrm_rm = ctxt -> decode .modrm_rm ,
421+ .src_val = ctxt -> decode .src .val64 ,
422+ .src_bytes = ctxt -> decode .src .bytes ,
423+ .dst_bytes = ctxt -> decode .dst .bytes ,
424+ .ad_bytes = ctxt -> decode .ad_bytes ,
425+ .next_rip = ctxt -> eip ,
426+ };
427+
428+ return ctxt -> ops -> intercept (ctxt -> vcpu , & info , stage );
429+ }
430+
411431static inline unsigned long ad_mask (struct decode_cache * c )
412432{
413433 return (1UL << (c -> ad_bytes << 3 )) - 1 ;
@@ -3132,8 +3152,8 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
31323152 }
31333153
31343154 if (unlikely (ctxt -> guest_mode ) && c -> intercept ) {
3135- rc = ops -> intercept (ctxt , c -> intercept ,
3136- X86_ICPT_PRE_EXCEPT );
3155+ rc = emulator_check_intercept (ctxt , c -> intercept ,
3156+ X86_ICPT_PRE_EXCEPT );
31373157 if (rc != X86EMUL_CONTINUE )
31383158 goto done ;
31393159 }
@@ -3158,8 +3178,8 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
31583178 }
31593179
31603180 if (unlikely (ctxt -> guest_mode ) && c -> intercept ) {
3161- rc = ops -> intercept (ctxt , c -> intercept ,
3162- X86_ICPT_POST_EXCEPT );
3181+ rc = emulator_check_intercept (ctxt , c -> intercept ,
3182+ X86_ICPT_POST_EXCEPT );
31633183 if (rc != X86EMUL_CONTINUE )
31643184 goto done ;
31653185 }
@@ -3203,8 +3223,8 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
32033223special_insn :
32043224
32053225 if (unlikely (ctxt -> guest_mode ) && c -> intercept ) {
3206- rc = ops -> intercept (ctxt , c -> intercept ,
3207- X86_ICPT_POST_MEMACCESS );
3226+ rc = emulator_check_intercept (ctxt , c -> intercept ,
3227+ X86_ICPT_POST_MEMACCESS );
32083228 if (rc != X86EMUL_CONTINUE )
32093229 goto done ;
32103230 }
0 commit comments