• Stafford Horne's avatar
    openrisc: Move FPU state out of pt_regs · 4dc70e1a
    Stafford Horne authored
    My original, naive, FPU support patch had the FPCSR register stored
    during both the *mode switch* and *context switch*.  This is wasteful.
    
    Also, the original patches did not save the FPU state when handling
    signals during the system call fast path.
    
    We fix this by moving the FPCSR state to thread_struct in task_struct.
    We also introduce new helper functions save_fpu and restore_fpu which
    can be used to sync the FPU with thread_struct.  These functions are now
    called when needed:
    
     - Setting up and restoring sigcontext when handling signals
     - Before and after __switch_to during context switches
     - When handling FPU exceptions
     - When reading and writing FPU register sets
    
    In the future we can further optimize this by doing lazy FPU save and
    restore.  For example, FPU sync is not needed when switching to and from
    kernel threads (x86 does this).  FPU save and restore does not need to
    be done two times if we have both rescheduling and signal work to do.
    However, since OpenRISC FPU state is a single register, I leave these
    optimizations for future consideration.
    Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
    4dc70e1a
ptrace.h 3.1 KB