From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHa28-00082P-VT for qemu-devel@nongnu.org; Tue, 30 Oct 2018 15:50:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHa25-0002Hl-M9 for qemu-devel@nongnu.org; Tue, 30 Oct 2018 15:50:36 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:39022) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHa25-0002Dt-CX for qemu-devel@nongnu.org; Tue, 30 Oct 2018 15:50:33 -0400 Received: by mail-wr1-x431.google.com with SMTP id r10-v6so13975942wrv.6 for ; Tue, 30 Oct 2018 12:50:26 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 30 Oct 2018 20:50:06 +0100 Message-Id: <1540929011-19894-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1540929011-19894-1-git-send-email-pbonzini@redhat.com> References: <1540929011-19894-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 05/10] target/i386: Clear RF on SYSCALL instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Rudolf Marek , Roman Kapl From: Rudolf Marek Fix the SYSCALL instruction in 64-bit (long mode). The RF flag should be cleared in R11 as well as in the RFLAGS. Intel and AMD CPUs behave same. AMD has this documented in the APM vol 3. Signed-off-by: Roman Kapl Signed-off-by: Rudolf Marek Message-Id: <20181019122449.26387-1-rka@sysgo.com> Signed-off-by: Paolo Bonzini --- target/i386/seg_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/seg_helper.c b/target/i386/seg_helper.c index 33714bc..63e265c 100644 --- a/target/i386/seg_helper.c +++ b/target/i386/seg_helper.c @@ -991,11 +991,11 @@ void helper_syscall(CPUX86State *env, int next_eip_addend) int code64; env->regs[R_ECX] = env->eip + next_eip_addend; - env->regs[11] = cpu_compute_eflags(env); + env->regs[11] = cpu_compute_eflags(env) & ~RF_MASK; code64 = env->hflags & HF_CS64_MASK; - env->eflags &= ~env->fmask; + env->eflags &= ~(env->fmask | RF_MASK); cpu_load_eflags(env, env->eflags, 0); cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, 0, 0xffffffff, -- 1.8.3.1