cvs commit: src/sys/ia64/ia64 exception.s

Marcel Moolenaar marcel at FreeBSD.org
Fri May 23 16:55:32 PDT 2003


marcel      2003/05/23 16:55:31 PDT

  FreeBSD src repository

  Modified files:
    sys/ia64/ia64        exception.s 
  Log:
  Fix a (new) source of instability:
  
  When interrupting a kernel context, we don't need to switch stacks
  (memory nor register). As such, we were also not restoring the
  register stack pointer (ar.bspstore). This, however, fails to be
  valid in 1 situation: when we interrupt a register stack switch as
  is being done in restorectx(). The problem is that restorectx()
  needs to have ar.bsp == ar.bspstore before it can assign the new
  value to ar.bspstore. This is achieved by doing a loadrs prior to
  assigning to ar.bspstore. If we take an interrupt in between the
  loadrs and the assignment and we don't make sure we restore the
  ar.bspstore prior to returning from the interrupt, we switch
  stacks with possibly non-zero dirty registers, which means that
  the new frame pointer (ar.bsp) will be invalid.
  
  So, instead of jumping over the restoration of the register frame
  pointer and related registers, we conditionalize it based on whether
  we return to kernel context or user context. A future performance
  tweak is possible by only restoring ar.bspstore when returning to
  kernel mode *and* when the RSE is in enforced lazy mode. One cannot
  assume ar.bsp == ar.bspstore if the RSE is not in enforced lazy mode
  anyway.
  
  While here (well, not quite) don't unconditionally assign to
  ar.bspstore in exception_save. Only do that when we actually switch
  stacks. It can only harm us to do it unconditionally.
  
  Approved by: re@ (blanket)
  
  Revision  Changes    Path
  1.44      +7 -8      src/sys/ia64/ia64/exception.s


More information about the cvs-src mailing list