• Andrew Morton's avatar
    [PATCH] ppc32: Handle altivec assist exception properly · 66a7d6a6
    Andrew Morton authored
    From: Paul Mackerras <paulus@samba.org>
    
    On machines with Altivec (i.e.  G4 and G5 processors), the altivec
    floating-point instructions can operate in two modes: one where
    denormalized inputs or outputs are truncated to zero, and one where they
    aren't.  In the latter mode the processor can take an exception when it
    encounters denormalized floating-point inputs or outputs rather than
    dealing with them in hardware.
    
    This patch adds code to deal properly with the exception, by emulating the
    instruction that caused the exception.  Previously the kernel just switched
    the altivec unit into the truncate-to-zero mode, which works but is a bit
    gross.  Fortunately there are only a limited set of altivec instructions
    which can generate the assist exception, so we don't have to emulate the
    whole altivec instruction set.
    
    This patch also makes sure that we always have a handler for the altivec
    unavailable exception.  Without this, if you run a kernel that is not
    configured for altivec support on a machine with altivec, it works fine
    until a user process tries to execute an altivec instruction.  At that
    point the kernel thinks it has taken an unknown exception and panics.  With
    this patch it sends a SIGILL to the process instead.
    66a7d6a6
vecemu.c 8.4 KB