@@ -130,6 +130,11 @@ static inline bool virtual_gif_enabled(CPUX86State *env)
130
130
return false;
131
131
}
132
132
133
+ static inline bool virtual_gif_set (CPUX86State * env )
134
+ {
135
+ return !virtual_gif_enabled (env ) || (env -> int_ctl & V_GIF_MASK );
136
+ }
137
+
133
138
void helper_vmrun (CPUX86State * env , int aflag , int next_eip_addend )
134
139
{
135
140
CPUState * cs = env_cpu (env );
@@ -364,6 +369,10 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
364
369
cs -> interrupt_request |= CPU_INTERRUPT_VIRQ ;
365
370
}
366
371
372
+ if (virtual_gif_set (env )) {
373
+ env -> hflags2 |= HF2_VGIF_MASK ;
374
+ }
375
+
367
376
/* maybe we need to inject an event */
368
377
event_inj = x86_ldl_phys (cs , env -> vm_vmcb + offsetof(struct vmcb ,
369
378
control .event_inj ));
@@ -520,6 +529,7 @@ void helper_stgi(CPUX86State *env)
520
529
521
530
if (virtual_gif_enabled (env )) {
522
531
env -> int_ctl |= V_GIF_MASK ;
532
+ env -> hflags2 |= HF2_VGIF_MASK ;
523
533
} else {
524
534
env -> hflags2 |= HF2_GIF_MASK ;
525
535
}
@@ -531,6 +541,7 @@ void helper_clgi(CPUX86State *env)
531
541
532
542
if (virtual_gif_enabled (env )) {
533
543
env -> int_ctl &= ~V_GIF_MASK ;
544
+ env -> hflags2 &= ~HF2_VGIF_MASK ;
534
545
} else {
535
546
env -> hflags2 &= ~HF2_GIF_MASK ;
536
547
}
@@ -812,6 +823,7 @@ void do_vmexit(CPUX86State *env)
812
823
env -> vm_vmcb + offsetof(struct vmcb , control .event_inj ), 0 );
813
824
814
825
env -> hflags2 &= ~HF2_GIF_MASK ;
826
+ env -> hflags2 &= ~HF2_VGIF_MASK ;
815
827
/* FIXME: Resets the current ASID register to zero (host ASID). */
816
828
817
829
/* Clears the V_IRQ and V_INTR_MASKING bits inside the processor. */
0 commit comments