Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e934c9c1c8742872a53efb84966d9c1d7b8c8e24
Commit:     e934c9c1c8742872a53efb84966d9c1d7b8c8e24
Parent:     7ee5d940f5064a7a4f0e53a8ffe755bc26a8b0f1
Author:     Avi Kivity <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 6 16:15:02 2007 +0200
Committer:  Avi Kivity <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 17:53:19 2008 +0200

    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 <[EMAIL PROTECTED]>
---
 drivers/kvm/x86_emulate.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 2e259a8..f423b0e 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -256,21 +256,21 @@ static u16 twobyte_table[256] = {
 #define EFLAGS_MASK (EFLG_OF|EFLG_SF|EFLG_ZF|EFLG_AF|EFLG_PF|EFLG_CF)
 
 /* Before executing instruction: restore necessary bits in EFLAGS. */
-#define _PRE_EFLAGS(_sav, _msk, _tmp) \
-       /* EFLAGS = (_sav & _msk) | (EFLAGS & ~_msk); */        \
-       "push %"_sav"; "                                        \
-       "movl %"_msk",%"_LO32 _tmp"; "                          \
-       "andl %"_LO32 _tmp",("_STK"); "                         \
-       "pushf; "                                               \
-       "notl %"_LO32 _tmp"; "                                  \
-       "andl %"_LO32 _tmp",("_STK"); "                         \
-       "pop  %"_tmp"; "                                        \
-       "orl  %"_LO32 _tmp",("_STK"); "                         \
-       "popf; "                                                \
-       /* _sav &= ~msk; */                                     \
-       "movl %"_msk",%"_LO32 _tmp"; "                          \
-       "notl %"_LO32 _tmp"; "                                  \
-       "andl %"_LO32 _tmp",%"_sav"; "
+#define _PRE_EFLAGS(_sav, _msk, _tmp)                                  \
+       /* EFLAGS = (_sav & _msk) | (EFLAGS & ~_msk); _sav &= ~_msk; */ \
+       "movl %"_sav",%"_LO32 _tmp"; "                                  \
+       "push %"_tmp"; "                                                \
+       "push %"_tmp"; "                                                \
+       "movl %"_msk",%"_LO32 _tmp"; "                                  \
+       "andl %"_LO32 _tmp",("_STK"); "                                 \
+       "pushf; "                                                       \
+       "notl %"_LO32 _tmp"; "                                          \
+       "andl %"_LO32 _tmp",("_STK"); "                                 \
+       "andl %"_LO32 _tmp","__stringify(BITS_PER_LONG/4)"("_STK"); "   \
+       "pop  %"_tmp"; "                                                \
+       "orl  %"_LO32 _tmp",("_STK"); "                                 \
+       "popf; "                                                        \
+       "pop  %"_sav"; "
 
 /* After executing instruction: write-back necessary bits in EFLAGS. */
 #define _POST_EFLAGS(_sav, _msk, _tmp) \
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to