2 * arch/sh/kernel/cpu/sh3/swsusp.S
4 * Copyright (C) 2009 Magnus Damm
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
10 #include <linux/sys.h>
11 #include <linux/errno.h>
12 #include <linux/linkage.h>
13 #include <asm/asm-offsets.h>
22 ! swsusp_arch_resume()
23 ! - copy restore_pblist pages
24 ! - restore registers from swsusp_arch_regs_cpu0
26 ENTRY(swsusp_arch_resume)
34 bt swsusp_restore_regs
36 mov.l @(PBE_ADDRESS, r4), r2
37 mov.l @(PBE_ORIG_ADDRESS, r4), r5
39 mov #(PAGE_SIZE >> 10), r3
41 shlr2 r3 /* PAGE_SIZE / 16 */
44 mov.l @r2+,r1 /* 16n+0 */
47 mov.l @r2+,r1 /* 16n+4 */
50 mov.l @r2+,r1 /* 16n+8 */
53 mov.l @r2+,r1 /* 16n+12 */
59 mov.l @(PBE_NEXT, r4), r4
62 ! BL=0: R7->R0 is bank0
68 ! BL=1: R7->R0 is bank1
83 ! BL=0: R7->R0 is bank0
86 1: .long swsusp_arch_regs_cpu0
87 2: .long restore_pblist
88 3: .long 0x20000000 ! RB=1
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)
97 sts pr, r0 ! save pr in r0
98 mov r15, r2 ! save sp in r2
99 mov r8, r5 ! save r8 in r5
101 ldc r1, ssr ! save sr in ssr
103 ldc r1, spc ! setup pc value for resuming
104 mov.l 5f, r15 ! use swsusp_arch_regs_cpu0 as stack
106 add r3, r15 ! save from top of structure
108 ! BL=0: R7->R0 is bank0
109 mov.l 2f, r3 ! get new SR value for bank1
112 jsr @r1 ! switch to bank1 and save bank1 r7->r0
115 ! BL=1: R7->R0 is bank1
116 stc r2_bank, k0 ! fetch old sp from r2_bank0
117 mov.l 3f, k4 ! SR bits to clear in k4
119 jsr @k1 ! switch to bank0 and save all regs
120 stc r0_bank, k3 ! fetch old pr from r0_bank0
122 ! BL=0: R7->R0 is bank0
123 mov r2, r15 ! restore old sp
124 mov r5, r8 ! restore old r8
126 ldc r1, sr ! restore old sr
127 lds r0, pr ! restore old pr
133 mov r2, r15 ! restore old sp
134 mov r5, r8 ! restore old r8
135 lds r0, pr ! restore old pr
140 1: .long swsusp_call_save
141 2: .long 0x20000000 ! RB=1
142 3: .long 0xdfffffff ! RB=0
144 5: .long swsusp_arch_regs_cpu0
145 6: .long SWSUSP_ARCH_REGS_SIZE
146 7: .long save_low_regs