Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2003 16:55:31 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/ia64/ia64 exception.s
Message-ID:  <200305232355.h4NNtVc7003031@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305232355.h4NNtVc7003031>