Changeset View
Changeset View
Standalone View
Standalone View
head/sys/powerpc/powerpc/altivec.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | save_vec_int(struct thread *td) | ||||
pcb = td->td_pcb; | pcb = td->td_pcb; | ||||
/* | /* | ||||
* Temporarily re-enable the vector unit during the save | * Temporarily re-enable the vector unit during the save | ||||
*/ | */ | ||||
msr = mfmsr(); | msr = mfmsr(); | ||||
mtmsr(msr | PSL_VEC); | mtmsr(msr | PSL_VEC); | ||||
isync(); | |||||
/* | /* | ||||
* Save the vector registers and VSCR to the PCB | * Save the vector registers and VSCR to the PCB | ||||
*/ | */ | ||||
#define STVX(n) __asm ("stvx %1,0,%0" \ | #define STVX(n) __asm ("stvx %1,0,%0" \ | ||||
:: "b"(pcb->pcb_vec.vr[n]), "n"(n)); | :: "b"(pcb->pcb_vec.vr[n]), "n"(n)); | ||||
STVX(0); STVX(1); STVX(2); STVX(3); | STVX(0); STVX(1); STVX(2); STVX(3); | ||||
STVX(4); STVX(5); STVX(6); STVX(7); | STVX(4); STVX(5); STVX(6); STVX(7); | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | enable_vec(struct thread *td) | ||||
} | } | ||||
/* | /* | ||||
* Temporarily enable the vector unit so the registers | * Temporarily enable the vector unit so the registers | ||||
* can be restored. | * can be restored. | ||||
*/ | */ | ||||
msr = mfmsr(); | msr = mfmsr(); | ||||
mtmsr(msr | PSL_VEC); | mtmsr(msr | PSL_VEC); | ||||
isync(); | |||||
/* | /* | ||||
* Restore VSCR by first loading it into a vector and then into VSCR. | * Restore VSCR by first loading it into a vector and then into VSCR. | ||||
* (this needs to done before loading the user's vector registers | * (this needs to done before loading the user's vector registers | ||||
* since we need to use a scratch vector register) | * since we need to use a scratch vector register) | ||||
*/ | */ | ||||
__asm __volatile("vxor 0,0,0; lvewx 0,0,%0; mtvscr 0" \ | __asm __volatile("vxor 0,0,0; lvewx 0,0,%0; mtvscr 0" \ | ||||
:: "b"(&pcb->pcb_vec.vscr)); | :: "b"(&pcb->pcb_vec.vscr)); | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |