Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * hibernate.c:  Hibernaton support specific for sparc64.
0004  *
0005  * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru)
0006  */
0007 
0008 #include <linux/mm.h>
0009 
0010 #include <asm/hibernate.h>
0011 #include <asm/visasm.h>
0012 #include <asm/page.h>
0013 #include <asm/sections.h>
0014 #include <asm/tlb.h>
0015 
0016 struct saved_context saved_context;
0017 
0018 /*
0019  *  pfn_is_nosave - check if given pfn is in the 'nosave' section
0020  */
0021 
0022 int pfn_is_nosave(unsigned long pfn)
0023 {
0024     unsigned long nosave_begin_pfn = PFN_DOWN((unsigned long)&__nosave_begin);
0025     unsigned long nosave_end_pfn = PFN_DOWN((unsigned long)&__nosave_end);
0026 
0027     return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
0028 }
0029 
0030 void save_processor_state(void)
0031 {
0032     save_and_clear_fpu();
0033 }
0034 
0035 void restore_processor_state(void)
0036 {
0037     struct mm_struct *mm = current->active_mm;
0038 
0039     tsb_context_switch_ctx(mm, CTX_HWBITS(mm->context));
0040 }