Vitaly Oratovsky vitaly_oratovsky at
Sat Sep 11 04:02:18 EST 1999

Brad Midgley wrote:

> the kernel needs to know how & when to stack and unstack the altivec
> registers.

To really do Altivec vector regs save/restore efficiently will require
cooperation between kernel and compiler.  Altivec architecture defines
a VRSAVE register, which is just a general purpose 32-bit wide bitmask.
The intention is for compiler to record usage of altivec registers in
the prologue of every function which uses them.  Likewise, the epilogue
is supposed to restore VRSAVE to the caller's state.  Of course, hand-
written assembly routines have to play by the same rules.

This approach permits saving/restoring the absolute minimum number of
vector unit regs, and [perhaps more importantly] only when the
thread was truly using them.

A less ambitious approach which doesn't require the compiler to mock
VRSAVE would be to allow the kernel to discover whether a particular
uses the vector unit by "faulting" in the vector unit enable bit in MSR
each process individually.

Cheers, Vitaly.

** Sent via the linuxppc-dev mail list. See

More information about the Linuxppc-dev mailing list