提交 54ca9095 编写于 作者: B bellard

generate GPF if non canonical addresses


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1681 c046a42c-6fe2-441c-8c8c-71466251a162
上级 56c8f68f
...@@ -904,7 +904,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, ...@@ -904,7 +904,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
/* we restore the process signal mask as the sigreturn should /* we restore the process signal mask as the sigreturn should
do it (XXX: use sigsetjmp) */ do it (XXX: use sigsetjmp) */
sigprocmask(SIG_SETMASK, old_set, NULL); sigprocmask(SIG_SETMASK, old_set, NULL);
raise_exception_err(EXCP0E_PAGE, env->error_code); raise_exception_err(env->exception_index, env->error_code);
} else { } else {
/* activate soft MMU for this block */ /* activate soft MMU for this block */
env->hflags |= HF_SOFTMMU_MASK; env->hflags |= HF_SOFTMMU_MASK;
......
...@@ -3478,9 +3478,9 @@ void tlb_fill(target_ulong addr, int is_write, int is_user, void *retaddr) ...@@ -3478,9 +3478,9 @@ void tlb_fill(target_ulong addr, int is_write, int is_user, void *retaddr)
} }
} }
if (retaddr) if (retaddr)
raise_exception_err(EXCP0E_PAGE, env->error_code); raise_exception_err(env->exception_index, env->error_code);
else else
raise_exception_err_norestore(EXCP0E_PAGE, env->error_code); raise_exception_err_norestore(env->exception_index, env->error_code);
} }
env = saved_env; env = saved_env;
} }
...@@ -566,6 +566,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr, ...@@ -566,6 +566,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
env->cr[2] = addr; env->cr[2] = addr;
env->error_code = (is_write << PG_ERROR_W_BIT); env->error_code = (is_write << PG_ERROR_W_BIT);
env->error_code |= PG_ERROR_U_MASK; env->error_code |= PG_ERROR_U_MASK;
env->exception_index = EXCP0E_PAGE;
return 1; return 1;
} }
...@@ -620,8 +621,9 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr, ...@@ -620,8 +621,9 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
/* test virtual address sign extension */ /* test virtual address sign extension */
sext = (int64_t)addr >> 47; sext = (int64_t)addr >> 47;
if (sext != 0 && sext != -1) { if (sext != 0 && sext != -1) {
error_code = 0; env->error_code = 0;
goto do_fault; env->exception_index = EXCP0D_GPF;
return 1;
} }
pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) & pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) &
...@@ -862,6 +864,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr, ...@@ -862,6 +864,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
(env->cr[4] & CR4_PAE_MASK)) (env->cr[4] & CR4_PAE_MASK))
error_code |= PG_ERROR_I_D_MASK; error_code |= PG_ERROR_I_D_MASK;
env->error_code = error_code; env->error_code = error_code;
env->exception_index = EXCP0E_PAGE;
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册