qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] x86-64 sign extension exception


From: Filip Navara
Subject: Re: [Qemu-devel] [PATCH] x86-64 sign extension exception
Date: Sun, 04 Dec 2005 15:40:59 +0100
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

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...
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 via email to

[Prev in Thread] Current Thread [Next in Thread]