Commit 54ca9095f046dfa03c3d093cc55f6d76b61864e1

Authored by bellard
1 parent 56c8f68f

generate GPF if non canonical addresses


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1681 c046a42c-6fe2-441c-8c8c-71466251a162
cpu-exec.c
... ... @@ -904,7 +904,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
904 904 /* we restore the process signal mask as the sigreturn should
905 905 do it (XXX: use sigsetjmp) */
906 906 sigprocmask(SIG_SETMASK, old_set, NULL);
907   - raise_exception_err(EXCP0E_PAGE, env->error_code);
  907 + raise_exception_err(env->exception_index, env->error_code);
908 908 } else {
909 909 /* activate soft MMU for this block */
910 910 env->hflags |= HF_SOFTMMU_MASK;
... ...
target-i386/helper.c
... ... @@ -3478,9 +3478,9 @@ void tlb_fill(target_ulong addr, int is_write, int is_user, void *retaddr)
3478 3478 }
3479 3479 }
3480 3480 if (retaddr)
3481   - raise_exception_err(EXCP0E_PAGE, env->error_code);
  3481 + raise_exception_err(env->exception_index, env->error_code);
3482 3482 else
3483   - raise_exception_err_norestore(EXCP0E_PAGE, env->error_code);
  3483 + raise_exception_err_norestore(env->exception_index, env->error_code);
3484 3484 }
3485 3485 env = saved_env;
3486 3486 }
... ...
target-i386/helper2.c
... ... @@ -566,6 +566,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
566 566 env->cr[2] = addr;
567 567 env->error_code = (is_write << PG_ERROR_W_BIT);
568 568 env->error_code |= PG_ERROR_U_MASK;
  569 + env->exception_index = EXCP0E_PAGE;
569 570 return 1;
570 571 }
571 572  
... ... @@ -620,8 +621,9 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
620 621 /* test virtual address sign extension */
621 622 sext = (int64_t)addr >> 47;
622 623 if (sext != 0 && sext != -1) {
623   - error_code = 0;
624   - goto do_fault;
  624 + env->error_code = 0;
  625 + env->exception_index = EXCP0D_GPF;
  626 + return 1;
625 627 }
626 628  
627 629 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 864 (env->cr[4] & CR4_PAE_MASK))
863 865 error_code |= PG_ERROR_I_D_MASK;
864 866 env->error_code = error_code;
  867 + env->exception_index = EXCP0E_PAGE;
865 868 return 1;
866 869 }
867 870  
... ...