qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Filip Navara <navaraf@reactos.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] x86-64 sign extension exception
Date: Sun, 04 Dec 2005 15:40:59 +0100	[thread overview]
Message-ID: <4392FFFB.2060801@reactos.com> (raw)
In-Reply-To: <4392BABB.1000903@volny.cz>

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

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...

[-- Attachment #2: qemu-64-gpf.diff --]
[-- Type: text/x-patch, Size: 2115 bytes --]

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)

      reply	other threads:[~2005-12-04 14:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-04  9:45 [Qemu-devel] [PATCH] x86-64 sign extension exception Filip Navara
2005-12-04 14:40 ` Filip Navara [this message]

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=4392FFFB.2060801@reactos.com \
    --to=navaraf@reactos.com \
    --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).