Changeset 11893


Ignore:
Timestamp:
Apr 4, 2009, 8:08:47 PM (10 years ago)
Author:
gb
Message:

Back out of part of earlier change; call handle_fault on anything
that seems to be a memory fault. Let handle_fault() distinguish
between x86 page faults (where the address is valid) and other
types of invalid memory accesses.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-exceptions.c

    r11889 r11893  
    866866#endif
    867867#endif
    868 
    869 
    870   if (addr && (addr == tcr->safe_ref_address)) {
    871     xpGPR(xp,Iimm0) = 0;
    872     xpPC(xp) = xpGPR(xp,Ira0);
    873     return true;
    874   } else {
    875     protected_area *a = find_protected_area(addr);
    876     protection_handler *handler;
    877 
    878     if (a) {
    879       handler = protection_handlers[a->why];
    880       return handler(xp, a, addr);
     868  Boolean valid = IS_PAGE_FAULT(info,xp);
     869
     870  if (valid) {
     871    if (addr && (addr == tcr->safe_ref_address)) {
     872      xpGPR(xp,Iimm0) = 0;
     873      xpPC(xp) = xpGPR(xp,Ira0);
     874      return true;
    881875    } else {
    882       if ((addr >= readonly_area->low) &&
    883           (addr < readonly_area->active)) {
    884         UnProtectMemory((LogicalAddress)(truncate_to_power_of_2(addr,log2_page_size)),
    885                         page_size);
    886         return true;
     876      protected_area *a = find_protected_area(addr);
     877      protection_handler *handler;
     878     
     879      if (a) {
     880        handler = protection_handlers[a->why];
     881        return handler(xp, a, addr);
     882      } else {
     883        if ((addr >= readonly_area->low) &&
     884            (addr < readonly_area->active)) {
     885          UnProtectMemory((LogicalAddress)(truncate_to_power_of_2(addr,log2_page_size)),
     886                          page_size);
     887          return true;
     888        }
    887889      }
    888890    }
     
    894896      (header_subtag(header_of(cmain)) == subtag_macptr)) {
    895897      xcf = create_exception_callback_frame(xp, tcr);
    896       callback_to_lisp(tcr, cmain, xp, xcf, SIGBUS, is_write_fault(xp,info), (natural)addr, 0);
     898      callback_to_lisp(tcr, cmain, xp, xcf, SIGBUS, valid ? is_write_fault(xp,info) : (natural)-1, valid ? (natural)addr : 0, 0);
    897899    }
    898900  }
     
    10931095
    10941096    } else {
    1095       if (old_valence == TCR_STATE_LISP) {
    1096         LispObj cmain = nrs_CMAIN.vcell,
    1097           xcf;
    1098         if ((fulltag_of(cmain) == fulltag_misc) &&
    1099             (header_subtag(header_of(cmain)) == subtag_macptr)) {
    1100           xcf = create_exception_callback_frame(context, tcr);
    1101           callback_to_lisp(tcr, cmain, context, xcf, SIGBUS, (natural)-1,0, 0);
    1102         }
    1103       }
    1104       return false;
     1097      return handle_fault(tcr, context, info, old_valence);
    11051098    }
    11061099    break;
Note: See TracChangeset for help on using the changeset viewer.