ia64/xen-unstable

changeset 16164:959b4b92b6bf

x86: Fix EFLAGS adjustment for emulated instructions.
Issue flagged by David Lively <dlively@virtualiron.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Fri Oct 19 17:44:20 2007 +0100 (2007-10-19)
parents 08295dc13166
children 975811798ffe
files xen/arch/x86/x86_emulate.c
line diff
     1.1 --- a/xen/arch/x86/x86_emulate.c	Fri Oct 19 14:49:08 2007 +0100
     1.2 +++ b/xen/arch/x86/x86_emulate.c	Fri Oct 19 17:44:20 2007 +0100
     1.3 @@ -299,21 +299,21 @@ struct operand {
     1.4  #define EFLAGS_MASK (EFLG_OF|EFLG_SF|EFLG_ZF|EFLG_AF|EFLG_PF|EFLG_CF)
     1.5  
     1.6  /* Before executing instruction: restore necessary bits in EFLAGS. */
     1.7 -#define _PRE_EFLAGS(_sav, _msk, _tmp)           \
     1.8 -/* EFLAGS = (_sav & _msk) | (EFLAGS & ~_msk); */\
     1.9 -"push %"_sav"; "                                \
    1.10 -"movl %"_msk",%"_LO32 _tmp"; "                  \
    1.11 -"andl %"_LO32 _tmp",("_STK"); "                 \
    1.12 -"pushf; "                                       \
    1.13 -"notl %"_LO32 _tmp"; "                          \
    1.14 -"andl %"_LO32 _tmp",("_STK"); "                 \
    1.15 -"pop  %"_tmp"; "                                \
    1.16 -"orl  %"_LO32 _tmp",("_STK"); "                 \
    1.17 -"popf; "                                        \
    1.18 -/* _sav &= ~msk; */                             \
    1.19 -"movl %"_msk",%"_LO32 _tmp"; "                  \
    1.20 -"notl %"_LO32 _tmp"; "                          \
    1.21 -"andl %"_LO32 _tmp",%"_sav"; "
    1.22 +#define _PRE_EFLAGS(_sav, _msk, _tmp)                           \
    1.23 +/* EFLAGS = (_sav & _msk) | (EFLAGS & ~_msk); _sav &= ~_msk; */ \
    1.24 +"movl %"_sav",%"_LO32 _tmp"; "                                  \
    1.25 +"push %"_tmp"; "                                                \
    1.26 +"push %"_tmp"; "                                                \
    1.27 +"movl %"_msk",%"_LO32 _tmp"; "                                  \
    1.28 +"andl %"_LO32 _tmp",("_STK"); "                                 \
    1.29 +"pushf; "                                                       \
    1.30 +"notl %"_LO32 _tmp"; "                                          \
    1.31 +"andl %"_LO32 _tmp",("_STK"); "                                 \
    1.32 +"andl %"_LO32 _tmp","STR(BITS_PER_LONG/4)"("_STK"); "           \
    1.33 +"pop  %"_tmp"; "                                                \
    1.34 +"orl  %"_LO32 _tmp",("_STK"); "                                 \
    1.35 +"popf; "                                                        \
    1.36 +"pop  %"_sav"; "
    1.37  
    1.38  /* After executing instruction: write-back necessary bits in EFLAGS. */
    1.39  #define _POST_EFLAGS(_sav, _msk, _tmp)          \