From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Eiv3W-00065n-FR for qemu-devel@nongnu.org; Sun, 04 Dec 2005 09:41:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Eiv3H-00064Y-Vs for qemu-devel@nongnu.org; Sun, 04 Dec 2005 09:41:24 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eiv3D-00064N-DI for qemu-devel@nongnu.org; Sun, 04 Dec 2005 09:41:16 -0500 Received: from [195.250.128.78] (helo=smtp1.vol.cz) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Eiv3Y-0004aM-4K for qemu-devel@nongnu.org; Sun, 04 Dec 2005 09:41:36 -0500 Received: from [10.0.0.4] (prg-v-6-220.static.adsl.vol.cz [62.177.70.220]) by smtp1.vol.cz (Postfix) with ESMTP id 2DA983FFB0 for ; Sun, 4 Dec 2005 15:41:06 +0100 (CET) Message-ID: <4392FFFB.2060801@reactos.com> Date: Sun, 04 Dec 2005 15:40:59 +0100 From: Filip Navara MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] x86-64 sign extension exception References: <4392BABB.1000903@volny.cz> In-Reply-To: <4392BABB.1000903@volny.cz> Content-Type: multipart/mixed; boundary="------------070600080904010300000202" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------070600080904010300000202 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Filip Navara wrote: > Changelog: > Raise a GPF exception instead of page fault if the sign extension of > 64-bit address isn't valid. sigh, i should never make patches just after i wake up... --------------070600080904010300000202 Content-Type: text/x-patch; name="qemu-64-gpf.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-64-gpf.diff" Index: target-i386/helper.c =================================================================== RCS file: /cvsroot/qemu/qemu/target-i386/helper.c,v retrieving revision 1.58 diff -u -r1.58 helper.c --- target-i386/helper.c 28 Nov 2005 21:01:52 -0000 1.58 +++ target-i386/helper.c 3 Dec 2005 21:07:24 -0000 @@ -3478,9 +3478,9 @@ } } if (retaddr) - raise_exception_err(EXCP0E_PAGE, env->error_code); + raise_exception_err(ret, env->error_code); else - raise_exception_err_norestore(EXCP0E_PAGE, env->error_code); + raise_exception_err_norestore(ret, env->error_code); } env = saved_env; } Index: target-i386/helper2.c =================================================================== RCS file: /cvsroot/qemu/qemu/target-i386/helper2.c,v retrieving revision 1.38 diff -u -r1.38 helper2.c --- target-i386/helper2.c 28 Nov 2005 21:19:42 -0000 1.38 +++ target-i386/helper2.c 3 Dec 2005 21:09:22 -0000 @@ -566,7 +566,7 @@ env->cr[2] = addr; env->error_code = (is_write << PG_ERROR_W_BIT); env->error_code |= PG_ERROR_U_MASK; - return 1; + return EXCP0E_PAGE; } target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr) @@ -621,7 +621,7 @@ sext = (int64_t)addr >> 47; if (sext != 0 && sext != -1) { - error_code = 0; + env->error_code = 0; - goto do_fault; + return EXCP0D_GPF; } pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) & @@ -849,7 +849,7 @@ vaddr = virt_addr + page_offset; ret = tlb_set_page_exec(env, vaddr, paddr, prot, is_user, is_softmmu); - return ret; + return ret ? EXCP0E_PAGE : 0; do_fault_protect: error_code = PG_ERROR_P_MASK; do_fault: @@ -862,7 +862,7 @@ (env->cr[4] & CR4_PAE_MASK)) error_code |= PG_ERROR_I_D_MASK; env->error_code = error_code; - return 1; + return EXCP0E_PAGE; } target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr) --------------070600080904010300000202--