Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Suspend support specific for mips.
0004  *
0005  * Copyright (C) 2009 Lemote Inc.
0006  * Author: Hu Hongbing <huhb@lemote.com>
0007  *     Wu Zhangjin <wuzhangjin@gmail.com>
0008  */
0009 #include <asm/sections.h>
0010 #include <asm/fpu.h>
0011 #include <asm/dsp.h>
0012 
0013 static u32 saved_status;
0014 struct pt_regs saved_regs;
0015 
0016 void save_processor_state(void)
0017 {
0018     saved_status = read_c0_status();
0019 
0020     if (is_fpu_owner())
0021         save_fp(current);
0022 
0023     save_dsp(current);
0024 }
0025 
0026 void restore_processor_state(void)
0027 {
0028     write_c0_status(saved_status);
0029 
0030     if (is_fpu_owner())
0031         restore_fp(current);
0032 
0033     restore_dsp(current);
0034 }
0035 
0036 int pfn_is_nosave(unsigned long pfn)
0037 {
0038     unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
0039     unsigned long nosave_end_pfn = PFN_UP(__pa(&__nosave_end));
0040 
0041     return  (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
0042 }