Skip to content

Commit

Permalink
libcpu: fixed hflags initialization in cpu_compute_hflags
Browse files Browse the repository at this point in the history
It was using stale values, causing guest crashes on resume.

Signed-off-by: Vitaly Chipounov <[email protected]>
  • Loading branch information
vitalych committed Nov 24, 2024
1 parent db1b91b commit b7ddb39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libcpu/src/target-i386/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/// \return the value for hflags
///
uint32_t cpu_compute_hflags(const CPUX86State *env) {
uint32_t hflags = 0;
uint32_t hflags = HF_SOFTMMU_MASK;

/* Update CR0 flags */
target_ulong pe_state = (env->cr[0] & CR0_PE_MASK);
Expand Down Expand Up @@ -89,7 +89,7 @@ uint32_t cpu_compute_hflags(const CPUX86State *env) {
hflags |= ((env->segs[R_DS].base | env->segs[R_ES].base | env->segs[R_SS].base) != 0) << HF_ADDSEG_SHIFT;
}

hflags = (env->hflags & ~(HF_SS32_MASK | HF_ADDSEG_MASK)) | hflags;
hflags = (hflags & ~(HF_SS32_MASK | HF_ADDSEG_MASK)) | hflags;

return hflags;
}
Expand Down

0 comments on commit b7ddb39

Please sign in to comment.