swsusp.c 833 B

12345678910111213141516171819202122232425262728293031323334353637
  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/current.h>
  13. #include <asm/mmu_context.h>
  14. #include <asm/switch_to.h>
  15. void save_processor_state(void)
  16. {
  17. /*
  18. * flush out all the special registers so we don't need
  19. * to save them in the snapshot
  20. */
  21. flush_all_to_thread(current);
  22. #ifdef CONFIG_PPC64
  23. hard_irq_disable();
  24. #endif
  25. }
  26. void restore_processor_state(void)
  27. {
  28. #ifdef CONFIG_PPC32
  29. switch_mmu_context(current->active_mm, current->active_mm, NULL);
  30. #endif
  31. }