hibernate.c 864 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * hibernate.c: Hibernaton support specific for sparc64.
  4. *
  5. * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru)
  6. */
  7. #include <linux/mm.h>
  8. #include <asm/hibernate.h>
  9. #include <asm/visasm.h>
  10. #include <asm/page.h>
  11. #include <asm/sections.h>
  12. #include <asm/tlb.h>
  13. struct saved_context saved_context;
  14. /*
  15. * pfn_is_nosave - check if given pfn is in the 'nosave' section
  16. */
  17. int pfn_is_nosave(unsigned long pfn)
  18. {
  19. unsigned long nosave_begin_pfn = PFN_DOWN((unsigned long)&__nosave_begin);
  20. unsigned long nosave_end_pfn = PFN_DOWN((unsigned long)&__nosave_end);
  21. return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
  22. }
  23. void save_processor_state(void)
  24. {
  25. save_and_clear_fpu();
  26. }
  27. void restore_processor_state(void)
  28. {
  29. struct mm_struct *mm = current->active_mm;
  30. tsb_context_switch_ctx(mm, CTX_HWBITS(mm->context));
  31. }