• Vineet Gupta's avatar
    ARCv2: entry: push out the Z flag unclobber from common EXCEPTION_PROLOGUE · 23c0cbd0
    Vineet Gupta authored
    Upon a taken interrupt/exception from User mode, HS hardware auto sets Z flag.
    This helps shave a few instructions from EXCEPTION_PROLOGUE by eliding
    re-reading ERSTATUS and some bit fiddling.
    
    However TLB Miss Exception handler can clobber the CPU flags and still end
    up in EXCEPTION_PROLOGUE in the slow path handling TLB handling case:
    
       EV_TLBMissD
         do_slow_path_pf
           EV_TLBProtV (aliased to call_do_page_fault)
              EXCEPTION_PROLOGUE
    
    As a result, EXCEPTION_PROLOGUE need to "unclobber" the Z flag which this
    patch changes. It is now pushed out to TLB Miss Exception handler.
    The reasons beings:
    
     - The flag restoration is only needed for slowpath TLB Miss Exception
       handling, but currently being in EXCEPTION_PROLOGUE penalizes all
       exceptions such as ProtV and syscall Trap, where Z flag is already
       as expected.
    
     - Pushing unclobber out to where it was clobbered is much cleaner and
       also serves to document the fact.
    
     - Makes EXCEPTION_PROLGUE similar to INTERRUPT_PROLOGUE so easier to
       refactor the common parts which is what this series aims to do
    Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
    23c0cbd0
entry-arcv2.h 6.37 KB