Ignore:
Timestamp:
Aug 5, 2010, 12:41:04 AM (10 years ago)
Author:
gb
Message:

Scheme for stack-overflow recovery (e.g., for re-protecting guard pages
after the stack is unwound past the point of overflow.)

A new TCR field, a new UUO, use of that UUO in nthrow subprims, handler
for the UUO.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/arm/lisp-kernel/arm-exceptions.c

    r14074 r14117  
    507507signal_stack_soft_overflow(ExceptionInformation *xp, unsigned reg)
    508508{
    509   /* The cstack just overflowed.  Force the current thread's
    510      control stack to do so until all stacks are well under their overflow
    511      limits.
    512   */
    513 
    514 #if 0
    515   lisp_global(CS_OVERFLOW_LIMIT) = CS_OVERFLOW_FORCE_LIMIT; /* force unsigned traps to fail */
    516 #endif
     509 
    517510  handle_error(xp, error_stack_overflow, reg, NULL);
    518511}
     
    928921  protected_area_ptr vsp_soft = a->softprot;
    929922  unprotect_area(vsp_soft);
     923  tcr->stack_overflowed |= STACK_OVERFLOW_VSTACK;
    930924  signal_stack_soft_overflow(xp,vsp);
    931925  return 0;
     
    937931do_soft_stack_overflow(ExceptionInformation *xp, protected_area_ptr prot_area, BytePtr addr)
    938932{
     933  TCR *tcr = get_tcr(true);
     934
    939935  /* Trying to write into a guard page on the vstack or tstack.
    940936     Allocate a new stack segment, emulate stwu and stwux for the TSP, and
     
    945941  }
    946942  unprotect_area(prot_area);
     943  tcr->stack_overflowed |= STACK_OVERFLOW_CSTACK;
    947944  signal_stack_soft_overflow(xp,Rsp);
    948945  return 0;
     
    10451042  opcode *there = (opcode *) where, instr, errnum = 0;
    10461043  return err;
     1044}
     1045
     1046Boolean
     1047try_stack_overflow_recovery(ExceptionInformation *xp, TCR *tcr)
     1048{
     1049  area *a;
     1050  protected_area_ptr soft;
     1051
     1052  if ((tcr->stack_overflowed) & STACK_OVERFLOW_CSTACK) {
     1053    a = tcr->cs_area;
     1054    soft = a->softprot;
     1055    if (((BytePtr)xpGPR(xp,Rsp)-STACK_RECOVERY_MARGIN) >
     1056        (soft->end)) {
     1057      protect_area(soft);
     1058      tcr->stack_overflowed &= ~STACK_OVERFLOW_CSTACK;
     1059    }
     1060  }
     1061
     1062  if ((tcr->stack_overflowed) & STACK_OVERFLOW_VSTACK) {
     1063    a = tcr->vs_area;
     1064    soft = a->softprot;
     1065    if (((BytePtr)xpGPR(xp,vsp)-STACK_RECOVERY_MARGIN) >
     1066        (soft->end)) {
     1067      protect_area(soft);
     1068      tcr->stack_overflowed &= ~STACK_OVERFLOW_VSTACK;
     1069    }
     1070  }
    10471071}
    10481072
     
    11311155      handled = true;
    11321156      break;
     1157    case 6:
     1158      try_stack_overflow_recovery(xp,tcr);
     1159      handled = true;
     1160      break;
    11331161    default:
    11341162      handled = false;
Note: See TracChangeset for help on using the changeset viewer.