s390fpu.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
- /*
- * arch/s390/kernel/s390fpu.c
- *
- * S390 version
- * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- *
- * s390fpu.h functions for saving & restoring the fpu state.
- *
- * I couldn't inline these as linux/sched.h included half the world
- * & was required to at the task structure.
- * & the functions were too complex to make macros from.
- * ( & as usual I didn't feel like debugging inline code ).
- */
- #include <linux/sched.h>
- void save_fp_regs(s390_fp_regs *fpregs)
- {
- /*
- * I don't think we can use STE here as this would load
- * fp registers 0 & 2 into memory locations 0 & 1 etc.
- */
- asm volatile ("STFPC 0(%0)nt"
- "STD 0,8(%0)nt"
- "STD 1,16(%0)nt"
- "STD 2,24(%0)nt"
- "STD 3,32(%0)nt"
- "STD 4,40(%0)nt"
- "STD 5,48(%0)nt"
- "STD 6,56(%0)nt"
- "STD 7,64(%0)nt"
- "STD 8,72(%0)nt"
- "STD 9,80(%0)nt"
- "STD 10,88(%0)nt"
- "STD 11,96(%0)nt"
- "STD 12,104(%0)nt"
- "STD 13,112(%0)nt"
- "STD 14,120(%0)nt"
- "STD 15,128(%0)nt"
- :
- : "a" (fpregs)
- : "memory"
- );
- }
- void restore_fp_regs(s390_fp_regs *fpregs)
- {
- /* If we don't mask with the FPC_VALID_MASK here
- * we've got a very quick shutdown -h now command
- * via a kernel specification exception.
- */
- fpregs->fpc&=FPC_VALID_MASK;
- asm volatile ("LFPC 0(%0)nt"
- "LD 0,8(%0)nt"
- "LD 1,16(%0)nt"
- "LD 2,24(%0)nt"
- "LD 3,32(%0)nt"
- "LD 4,40(%0)nt"
- "LD 5,48(%0)nt"
- "LD 6,56(%0)nt"
- "LD 7,64(%0)nt"
- "LD 8,72(%0)nt"
- "LD 9,80(%0)nt"
- "LD 10,88(%0)nt"
- "LD 11,96(%0)nt"
- "LD 12,104(%0)nt"
- "LD 13,112(%0)nt"
- "LD 14,120(%0)nt"
- "LD 15,128(%0)nt"
- :
- : "a" (fpregs)
- : "memory"
- );
- }