KVM: x86 emulator: fix eflags preparation for emulation
We prepare eflags for the emulated instruction, then clobber it with an 'andl'. Fix by popping eflags as the last thing in the sequence. Patch taken from Xen (16143:959b4b92b6bf) Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
Родитель
7ee5d940f5
Коммит
e934c9c1c8
|
@ -256,21 +256,21 @@ static u16 twobyte_table[256] = {
|
||||||
#define EFLAGS_MASK (EFLG_OF|EFLG_SF|EFLG_ZF|EFLG_AF|EFLG_PF|EFLG_CF)
|
#define EFLAGS_MASK (EFLG_OF|EFLG_SF|EFLG_ZF|EFLG_AF|EFLG_PF|EFLG_CF)
|
||||||
|
|
||||||
/* Before executing instruction: restore necessary bits in EFLAGS. */
|
/* Before executing instruction: restore necessary bits in EFLAGS. */
|
||||||
#define _PRE_EFLAGS(_sav, _msk, _tmp) \
|
#define _PRE_EFLAGS(_sav, _msk, _tmp) \
|
||||||
/* EFLAGS = (_sav & _msk) | (EFLAGS & ~_msk); */ \
|
/* EFLAGS = (_sav & _msk) | (EFLAGS & ~_msk); _sav &= ~_msk; */ \
|
||||||
"push %"_sav"; " \
|
"movl %"_sav",%"_LO32 _tmp"; " \
|
||||||
"movl %"_msk",%"_LO32 _tmp"; " \
|
"push %"_tmp"; " \
|
||||||
"andl %"_LO32 _tmp",("_STK"); " \
|
"push %"_tmp"; " \
|
||||||
"pushf; " \
|
"movl %"_msk",%"_LO32 _tmp"; " \
|
||||||
"notl %"_LO32 _tmp"; " \
|
"andl %"_LO32 _tmp",("_STK"); " \
|
||||||
"andl %"_LO32 _tmp",("_STK"); " \
|
"pushf; " \
|
||||||
"pop %"_tmp"; " \
|
"notl %"_LO32 _tmp"; " \
|
||||||
"orl %"_LO32 _tmp",("_STK"); " \
|
"andl %"_LO32 _tmp",("_STK"); " \
|
||||||
"popf; " \
|
"andl %"_LO32 _tmp","__stringify(BITS_PER_LONG/4)"("_STK"); " \
|
||||||
/* _sav &= ~msk; */ \
|
"pop %"_tmp"; " \
|
||||||
"movl %"_msk",%"_LO32 _tmp"; " \
|
"orl %"_LO32 _tmp",("_STK"); " \
|
||||||
"notl %"_LO32 _tmp"; " \
|
"popf; " \
|
||||||
"andl %"_LO32 _tmp",%"_sav"; "
|
"pop %"_sav"; "
|
||||||
|
|
||||||
/* After executing instruction: write-back necessary bits in EFLAGS. */
|
/* After executing instruction: write-back necessary bits in EFLAGS. */
|
||||||
#define _POST_EFLAGS(_sav, _msk, _tmp) \
|
#define _POST_EFLAGS(_sav, _msk, _tmp) \
|
||||||
|
|
Загрузка…
Ссылка в новой задаче