hibernate.c 828 B

123456789101112131415161718192021222324252627282930313233343536373839
  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/sections.h>
  11. #include <asm/tlb.h>
  12. struct saved_context saved_context;
  13. /*
  14. * pfn_is_nosave - check if given pfn is in the 'nosave' section
  15. */
  16. int pfn_is_nosave(unsigned long pfn)
  17. {
  18. unsigned long nosave_begin_pfn = PFN_DOWN((unsigned long)&__nosave_begin);
  19. unsigned long nosave_end_pfn = PFN_DOWN((unsigned long)&__nosave_end);
  20. return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
  21. }
  22. void save_processor_state(void)
  23. {
  24. save_and_clear_fpu();
  25. }
  26. void restore_processor_state(void)
  27. {
  28. struct mm_struct *mm = current->active_mm;
  29. tsb_context_switch_ctx(mm, CTX_HWBITS(mm->context));
  30. }