1 /* SPDX-License-Identifier: GPL-2.0 */ !! 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 2 /* 3 * Hibernation support specific for LoongArch !! 3 * Hibernation support specific for mips - temporary page tables 4 * 4 * 5 * Author: Huacai Chen <chenhuacai@loongson.cn> !! 5 * Copyright (C) 2009 Lemote Inc. 6 * Copyright (C) 2020-2022 Loongson Technology !! 6 * Author: Hu Hongbing <huhb@lemote.com> >> 7 * Wu Zhangjin <wuzhangjin@gmail.com> 7 */ 8 */ 8 #include <linux/linkage.h> << 9 #include <asm/asm.h> << 10 #include <asm/asm-offsets.h> 9 #include <asm/asm-offsets.h> 11 #include <asm/regdef.h> 10 #include <asm/regdef.h> >> 11 #include <asm/asm.h> 12 12 13 .text 13 .text 14 SYM_FUNC_START(swsusp_asm_suspend) !! 14 LEAF(swsusp_arch_suspend) 15 la.pcrel t0, saved_regs !! 15 PTR_LA t0, saved_regs 16 PTR_S ra, t0, PT_R1 !! 16 PTR_S ra, PT_R31(t0) 17 PTR_S tp, t0, PT_R2 !! 17 PTR_S sp, PT_R29(t0) 18 PTR_S sp, t0, PT_R3 !! 18 PTR_S fp, PT_R30(t0) 19 PTR_S u0, t0, PT_R21 !! 19 PTR_S gp, PT_R28(t0) 20 PTR_S fp, t0, PT_R22 !! 20 PTR_S s0, PT_R16(t0) 21 PTR_S s0, t0, PT_R23 !! 21 PTR_S s1, PT_R17(t0) 22 PTR_S s1, t0, PT_R24 !! 22 PTR_S s2, PT_R18(t0) 23 PTR_S s2, t0, PT_R25 !! 23 PTR_S s3, PT_R19(t0) 24 PTR_S s3, t0, PT_R26 !! 24 PTR_S s4, PT_R20(t0) 25 PTR_S s4, t0, PT_R27 !! 25 PTR_S s5, PT_R21(t0) 26 PTR_S s5, t0, PT_R28 !! 26 PTR_S s6, PT_R22(t0) 27 PTR_S s6, t0, PT_R29 !! 27 PTR_S s7, PT_R23(t0) 28 PTR_S s7, t0, PT_R30 !! 28 j swsusp_save 29 PTR_S s8, t0, PT_R31 !! 29 END(swsusp_arch_suspend) 30 b swsusp_save << 31 SYM_FUNC_END(swsusp_asm_suspend) << 32 30 33 SYM_FUNC_START(swsusp_asm_resume) !! 31 LEAF(restore_image) 34 la.pcrel t0, restore_pblist !! 32 PTR_L t0, restore_pblist 35 PTR_L t0, t0, 0 << 36 0: 33 0: 37 PTR_L t1, t0, PBE_ADDRESS / !! 34 PTR_L t1, PBE_ADDRESS(t0) /* source */ 38 PTR_L t2, t0, PBE_ORIG_ADDRE !! 35 PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */ 39 PTR_LI t3, _PAGE_SIZE !! 36 PTR_ADDU t3, t1, _PAGE_SIZE 40 PTR_ADD t3, t3, t1 << 41 1: 37 1: 42 REG_L t8, t1, 0 !! 38 REG_L t8, (t1) 43 REG_S t8, t2, 0 !! 39 REG_S t8, (t2) 44 PTR_ADDI t1, t1, SZREG !! 40 PTR_ADDIU t1, t1, SZREG 45 PTR_ADDI t2, t2, SZREG !! 41 PTR_ADDIU t2, t2, SZREG 46 bne t1, t3, 1b !! 42 bne t1, t3, 1b 47 PTR_L t0, t0, PBE_NEXT !! 43 PTR_L t0, PBE_NEXT(t0) 48 bnez t0, 0b !! 44 bnez t0, 0b 49 la.pcrel t0, saved_regs !! 45 PTR_LA t0, saved_regs 50 PTR_L ra, t0, PT_R1 !! 46 PTR_L ra, PT_R31(t0) 51 PTR_L tp, t0, PT_R2 !! 47 PTR_L sp, PT_R29(t0) 52 PTR_L sp, t0, PT_R3 !! 48 PTR_L fp, PT_R30(t0) 53 PTR_L u0, t0, PT_R21 !! 49 PTR_L gp, PT_R28(t0) 54 PTR_L fp, t0, PT_R22 !! 50 PTR_L s0, PT_R16(t0) 55 PTR_L s0, t0, PT_R23 !! 51 PTR_L s1, PT_R17(t0) 56 PTR_L s1, t0, PT_R24 !! 52 PTR_L s2, PT_R18(t0) 57 PTR_L s2, t0, PT_R25 !! 53 PTR_L s3, PT_R19(t0) 58 PTR_L s3, t0, PT_R26 !! 54 PTR_L s4, PT_R20(t0) 59 PTR_L s4, t0, PT_R27 !! 55 PTR_L s5, PT_R21(t0) 60 PTR_L s5, t0, PT_R28 !! 56 PTR_L s6, PT_R22(t0) 61 PTR_L s6, t0, PT_R29 !! 57 PTR_L s7, PT_R23(t0) 62 PTR_L s7, t0, PT_R30 !! 58 PTR_LI v0, 0x0 63 PTR_L s8, t0, PT_R31 !! 59 jr ra 64 PTR_LI a0, 0x0 !! 60 END(restore_image) 65 jirl zero, ra, 0 << 66 SYM_FUNC_END(swsusp_asm_resume) <<
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.