hibernate.c 890 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * hibernate.c: Hibernaton support specific for sparc64.
  3. *
  4. * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru)
  5. */
  6. #include <linux/mm.h>
  7. #include <asm/hibernate.h>
  8. #include <asm/visasm.h>
  9. #include <asm/page.h>
  10. #include <asm/tlb.h>
  11. /* References to section boundaries */
  12. extern const void __nosave_begin, __nosave_end;
  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. load_secondary_context(mm);
  31. tsb_context_switch(mm);
  32. }