swsusp.c 900 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Common powerpc suspend code for 32 and 64 bits
  3. *
  4. * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #include <linux/sched.h>
  12. #include <asm/suspend.h>
  13. #include <asm/system.h>
  14. #include <asm/current.h>
  15. #include <asm/mmu_context.h>
  16. void save_processor_state(void)
  17. {
  18. /*
  19. * flush out all the special registers so we don't need
  20. * to save them in the snapshot
  21. */
  22. flush_fp_to_thread(current);
  23. flush_altivec_to_thread(current);
  24. flush_spe_to_thread(current);
  25. #ifdef CONFIG_PPC64
  26. hard_irq_disable();
  27. #endif
  28. }
  29. void restore_processor_state(void)
  30. {
  31. #ifdef CONFIG_PPC32
  32. switch_mmu_context(NULL, current->active_mm);
  33. #endif
  34. }