Received: from eggs.gnu.org ([2001:4830:134:3::10]:57210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2MOv-0005jL-TJ for qemu-devel@nongnu.org; Sun, 12 Jan 2014 09:52:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2MOq-00012v-Hg for qemu-devel@nongnu.org; Sun, 12 Jan 2014 09:52:33 -0500 Received: from mout.gmx.net ([212.227.17.22]:63747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2MOq-00012Y-7z for qemu-devel@nongnu.org; Sun, 12 Jan 2014 09:52:28 -0500 Received: from t430s.bluhm.invalid ([80.154.94.48]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MNf1y-1VzcZs26fa-007ASm for ; Sun, 12 Jan 2014 15:52:26 +0100 Date: Sun, 12 Jan 2014 15:52:21 +0100 From: Alexander Bluhm Message-ID: <20140112145221.GC5829@t430s.bluhm.invalid> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] X86_64 ucomisd memory access List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 : 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 --- 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);