cpu.c 859 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Suspend support specific for mips.
  3. *
  4. * Licensed under the GPLv2
  5. *
  6. * Copyright (C) 2009 Lemote Inc.
  7. * Author: Hu Hongbing <huhb@lemote.com>
  8. * Wu Zhangjin <wuzhangjin@gmail.com>
  9. */
  10. #include <asm/sections.h>
  11. #include <asm/fpu.h>
  12. #include <asm/dsp.h>
  13. static u32 saved_status;
  14. struct pt_regs saved_regs;
  15. void save_processor_state(void)
  16. {
  17. saved_status = read_c0_status();
  18. if (is_fpu_owner())
  19. save_fp(current);
  20. if (cpu_has_dsp)
  21. save_dsp(current);
  22. }
  23. void restore_processor_state(void)
  24. {
  25. write_c0_status(saved_status);
  26. if (is_fpu_owner())
  27. restore_fp(current);
  28. if (cpu_has_dsp)
  29. restore_dsp(current);
  30. }
  31. int pfn_is_nosave(unsigned long pfn)
  32. {
  33. unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
  34. unsigned long nosave_end_pfn = PFN_UP(__pa(&__nosave_end));
  35. return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
  36. }