Commit afdf8109e3c5c30d312a844436c658f7506e4189

Authored by blueswir1
1 parent 164ef2e0

Fix TLB access (Jakub Jermar)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6274 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 10 deletions
target-sparc/helper.c
... ... @@ -402,12 +402,12 @@ static int get_physical_address_data(CPUState *env,
402 402 mask = 0xffffffffffc00000ULL;
403 403 break;
404 404 }
405   - // ctx match, vaddr match?
  405 + // ctx match, vaddr match, valid?
406 406 if (env->dmmuregs[1] == (env->dtlb_tag[i] & 0x1fff) &&
407   - (address & mask) == (env->dtlb_tag[i] & ~0x1fffULL)) {
408   - // valid, access ok?
409   - if ((env->dtlb_tte[i] & 0x8000000000000000ULL) == 0 ||
410   - ((env->dtlb_tte[i] & 0x4) && is_user) ||
  407 + (address & mask) == (env->dtlb_tag[i] & ~0x1fffULL) &&
  408 + (env->dtlb_tte[i] & 0x8000000000000000ULL)) {
  409 + // access ok?
  410 + if (((env->dtlb_tte[i] & 0x4) && is_user) ||
411 411 (!(env->dtlb_tte[i] & 0x2) && (rw == 1))) {
412 412 if (env->dmmuregs[3]) /* Fault status register */
413 413 env->dmmuregs[3] = 2; /* overflow (not read before
... ... @@ -465,12 +465,12 @@ static int get_physical_address_code(CPUState *env,
465 465 mask = 0xffffffffffc00000ULL;
466 466 break;
467 467 }
468   - // ctx match, vaddr match?
  468 + // ctx match, vaddr match, valid?
469 469 if (env->dmmuregs[1] == (env->itlb_tag[i] & 0x1fff) &&
470   - (address & mask) == (env->itlb_tag[i] & ~0x1fffULL)) {
471   - // valid, access ok?
472   - if ((env->itlb_tte[i] & 0x8000000000000000ULL) == 0 ||
473   - ((env->itlb_tte[i] & 0x4) && is_user)) {
  470 + (address & mask) == (env->itlb_tag[i] & ~0x1fffULL) &&
  471 + (env->itlb_tte[i] & 0x8000000000000000ULL)) {
  472 + // access ok?
  473 + if ((env->itlb_tte[i] & 0x4) && is_user) {
474 474 if (env->immuregs[3]) /* Fault status register */
475 475 env->immuregs[3] = 2; /* overflow (not read before
476 476 another fault) */
... ...