1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/unicore32/kernel/hibernate_asm.S
5 * Code specific to PKUnity SoC and UniCore ISA
7 * Maintained by GUAN Xue-tao <gxt@mprc.pku.edu.cn>
8 * Copyright (C) 2001-2010 Guan Xuetao
11 #include <linux/sys.h>
12 #include <linux/errno.h>
13 #include <linux/linkage.h>
14 #include <generated/asm-offsets.h>
16 #include <asm/pgtable.h>
17 #include <asm/assembler.h>
19 @ restore_image(pgd_t *resume_pg_dir, struct pbe *restore_pblist)
22 @ copy restore_pblist pages
23 @ restore registers from swsusp_arch_regs_cpu0
26 sub r0, r0, #PAGE_OFFSET
28 movc p0.c6, r5, #6 @invalidate ITLB & DTLB
43 ldw r6, [r1+], #PBE_ADDRESS
44 ldw r7, [r1+], #PBE_ORIN_ADDRESS
47 102: ldm.w (r8 - r15), [r6]+
48 stm.w (r8 - r15), [r7]+
52 ldw r1, [r1+], #PBE_NEXT
57 /* go back to the original page tables */
58 ldw r0, =swapper_pg_dir
59 sub r0, r0, #PAGE_OFFSET
71 #ifdef CONFIG_UNICORE_FPU_F64
73 add ip, ip, #SWSUSP_FPSTATE
74 lfm.w (f0 - f7 ), [ip]+
75 lfm.w (f8 - f15), [ip]+
76 lfm.w (f16 - f23), [ip]+
77 lfm.w (f24 - f31), [ip]+
83 add ip, ip, #SWSUSP_CPU
84 ldm.w (r4 - r15), [ip]+
85 ldm (r16 - r27, sp, pc), [ip]+ @ Load all regs saved previously
88 1: .long swsusp_arch_regs_cpu0
91 @ swsusp_arch_suspend()
92 @ - prepare pc for resume, return from function without swsusp_save on resume
93 @ - save registers in swsusp_arch_regs_cpu0
94 @ - call swsusp_save write suspend image
96 ENTRY(swsusp_arch_suspend)
98 add ip, ip, #SWSUSP_CPU
99 stm.w (r4 - r15), [ip]+
100 stm.w (r16 - r27, sp, lr), [ip]+
102 #ifdef CONFIG_UNICORE_FPU_F64
104 add ip, ip, #SWSUSP_FPSTATE
105 sfm.w (f0 - f7 ), [ip]+
106 sfm.w (f8 - f15), [ip]+
107 sfm.w (f16 - f23), [ip]+
108 sfm.w (f24 - f31), [ip]+
112 b swsusp_save @ no return
114 1: .long swsusp_arch_regs_cpu0