PageRenderTime 24ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/arch/powerpc/math-emu/mcrfs.c

https://bitbucket.org/cresqo/cm7-p500-kernel
C | 32 lines | 24 code | 8 blank | 0 comment | 1 complexity | 2dcb2132a99559e3846168e9a1af6ef1 MD5 | raw file
Possible License(s): LGPL-2.0, AGPL-1.0, GPL-2.0
  1. #include <linux/types.h>
  2. #include <linux/errno.h>
  3. #include <asm/uaccess.h>
  4. #include <asm/sfp-machine.h>
  5. #include <math-emu/soft-fp.h>
  6. int
  7. mcrfs(u32 *ccr, u32 crfD, u32 crfS)
  8. {
  9. u32 value, clear;
  10. #ifdef DEBUG
  11. printk("%s: %p (%08x) %d %d\n", __func__, ccr, *ccr, crfD, crfS);
  12. #endif
  13. clear = 15 << ((7 - crfS) << 2);
  14. if (!crfS)
  15. clear = 0x90000000;
  16. value = (__FPU_FPSCR >> ((7 - crfS) << 2)) & 15;
  17. __FPU_FPSCR &= ~(clear);
  18. *ccr &= ~(15 << ((7 - crfD) << 2));
  19. *ccr |= (value << ((7 - crfD) << 2));
  20. #ifdef DEBUG
  21. printk("CR: %08x\n", __func__, *ccr);
  22. #endif
  23. return 0;
  24. }