cpu.c 833 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Suspend support specific for mips.
  4. *
  5. * Copyright (C) 2009 Lemote Inc.
  6. * Author: Hu Hongbing <[email protected]>
  7. * Wu Zhangjin <[email protected]>
  8. */
  9. #include <asm/sections.h>
  10. #include <asm/fpu.h>
  11. #include <asm/dsp.h>
  12. static u32 saved_status;
  13. struct pt_regs saved_regs;
  14. void save_processor_state(void)
  15. {
  16. saved_status = read_c0_status();
  17. if (is_fpu_owner())
  18. save_fp(current);
  19. save_dsp(current);
  20. }
  21. void restore_processor_state(void)
  22. {
  23. write_c0_status(saved_status);
  24. if (is_fpu_owner())
  25. restore_fp(current);
  26. restore_dsp(current);
  27. }
  28. int pfn_is_nosave(unsigned long pfn)
  29. {
  30. unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
  31. unsigned long nosave_end_pfn = PFN_UP(__pa(&__nosave_end));
  32. return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
  33. }