qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Bluhm <alexander.bluhm@gmx.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] X86_64 ucomisd memory access
Date: Sun, 12 Jan 2014 15:52:21 +0100	[thread overview]
Message-ID: <20140112145221.GC5829@t430s.bluhm.invalid> (raw)

I am running a software emulated OpenBSD/amd64 on an OpenBSD/amd64
host with qemu-system-x86_64 version 1.7.0.

A perl process within the emulated machine gets a segmentation fault
at this instruction:

0x00000cbf3e13f53c <S_sv_2iuv_common+108>:      ucomisd 0x28(%rax),%xmm0

The accessed address at 0x28(%rax) is 0xcbf38d13ff8, that is 8 bytes
before a page boundary.  The next page is not mapped.  The instruction
ucomisd should access a 64 bit memory location, so the perl programm
and the address layout are legal.  qemu generates a wrong page fault
as it assumes a 16 byte operation.

This patch fixes the problem, it is against qemu 1.7.0.

Signed-off-by: Alexander Bluhm <bluhm@openbsd.org>

--- target-i386/translate.c.orig	Wed Nov 27 23:15:55 2013
+++ target-i386/translate.c	Sun Jan 12 14:44:17 2014
@@ -4579,7 +4579,11 @@ static void gen_sse(CPUX86State *env, DisasContext *s,
                         gen_ldq_env_A0(s->mem_index, offsetof(CPUX86State,xmm_t0.XMM_D(0)));
                     }
                 } else {
-                    gen_ldo_env_A0(s->mem_index, op2_offset);
+		    if (b == 0x2e || b == 0x2f) {
+			gen_ldq_env_A0(s->mem_index, op2_offset);
+		    } else {
+			gen_ldo_env_A0(s->mem_index, op2_offset);
+		    }
                 }
             } else {
                 rm = (modrm & 7) | REX_B(s);

                 reply	other threads:[~2014-01-12 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140112145221.GC5829@t430s.bluhm.invalid \
    --to=alexander.bluhm@gmx.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).