~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/riscv/kernel/hibernate-asm.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/riscv/kernel/hibernate-asm.S (Version linux-6.12-rc7) and /arch/mips/kernel/hibernate-asm.S (Version linux-4.10.17)


  1 /* SPDX-License-Identifier: GPL-2.0-only */       
  2 /*                                                
  3  * Hibernation low level support for RISCV.       
  4  *                                                
  5  * Copyright (C) 2023 StarFive Technology Co.,    
  6  *                                                
  7  * Author: Jee Heng Sia <jeeheng.sia@starfivete    
  8  */                                               
  9                                                   
 10 #include <asm/asm.h>                              
 11 #include <asm/asm-offsets.h>                      
 12 #include <asm/assembler.h>                        
 13 #include <asm/csr.h>                              
 14                                                   
 15 #include <linux/linkage.h>                        
 16                                                   
 17 /*                                                
 18  * int __hibernate_cpu_resume(void)               
 19  * Switch back to the hibernated image's page     
 20  * context.                                       
 21  *                                                
 22  * Always returns 0                               
 23  */                                               
 24 SYM_FUNC_START(__hibernate_cpu_resume)            
 25         /* switch to hibernated image's page t    
 26         csrw CSR_SATP, s0                         
 27         sfence.vma                                
 28                                                   
 29         REG_L   a0, hibernate_cpu_context         
 30                                                   
 31         suspend_restore_regs                      
 32                                                   
 33         /* Return zero value. */                  
 34         mv      a0, zero                          
 35                                                   
 36         ret                                       
 37 SYM_FUNC_END(__hibernate_cpu_resume)              
 38                                                   
 39 /*                                                
 40  * Prepare to restore the image.                  
 41  * a0: satp of saved page tables.                 
 42  * a1: satp of temporary page tables.             
 43  * a2: cpu_resume.                                
 44  */                                               
 45 SYM_FUNC_START(hibernate_restore_image)           
 46         mv      s0, a0                            
 47         mv      s1, a1                            
 48         mv      s2, a2                            
 49         REG_L   s4, restore_pblist                
 50         REG_L   a1, relocated_restore_code        
 51                                                   
 52         jr      a1                                
 53 SYM_FUNC_END(hibernate_restore_image)             
 54                                                   
 55 /*                                                
 56  * The below code will be executed from a 'saf    
 57  * It first switches to the temporary page tab    
 58  * back to the original memory location. Final    
 59  * to restore the CPU context.                    
 60  */                                               
 61 SYM_FUNC_START(hibernate_core_restore_code)       
 62         /* switch to temp page table. */          
 63         csrw satp, s1                             
 64         sfence.vma                                
 65 .Lcopy:                                           
 66         /* The below code will restore the hib    
 67         REG_L   a1, HIBERN_PBE_ADDR(s4)           
 68         REG_L   a0, HIBERN_PBE_ORIG(s4)           
 69                                                   
 70         copy_page a0, a1                          
 71                                                   
 72         REG_L   s4, HIBERN_PBE_NEXT(s4)           
 73         bnez    s4, .Lcopy                        
 74                                                   
 75         jr      s2                                
 76 SYM_FUNC_END(hibernate_core_restore_code)         
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php