Skip to content
Snippets Groups Projects
Commit 12153175 authored by Qi Hu's avatar Qi Hu Committed by Paolo Bonzini
Browse files

target/i386: Fix calculation of LOCK NEG eflags


After:

        lock negl -0x14(%rbp)
        pushf
        pop    %rax

%rax will contain the wrong value because the "lock neg" calculates the
wrong eflags.  Simple test:

        #include <assert.h>

        int main()
        {
          __volatile__ unsigned test = 0x2363a;
          __volatile__ char cond = 0;
          asm(
              "lock negl %0 \n\t"
              "sets %1"
              : "=m"(test), "=r"(cond));
          assert(cond & 1);
          return 0;
        }

Reported-by: default avatarJinyang Shen <shenjinyang@loongson.cn>
Co-Developed-by: default avatarXuehai Chen <chenxuehai@loongson.cn>
Signed-off-by: default avatarXuehai Chen <chenxuehai@loongson.cn>
Signed-off-by: default avatarQi Hu <huqi@loongson.cn>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 75d30fde
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment