arch/sh/kernel/cpu/shmobile/sleep.S

Source file repositories/reference/linux-study-clean/arch/sh/kernel/cpu/shmobile/sleep.S

File Facts

System
Linux kernel
Corpus path
arch/sh/kernel/cpu/shmobile/sleep.S
Extension
.S
Size
6877 bytes
Lines
403
Domain
Architecture Layer
Bucket
arch/sh
Inferred role
Architecture Layer: arch/sh
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <linux/sys.h>
#include <linux/errno.h>
#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/suspend.h>

/*
 * Kernel mode register usage, see entry.S:
 *	k0	scratch
 *	k1	scratch
 */
#define k0	r0
#define k1	r1

/* manage self-refresh and enter standby mode. must be self-contained.
 * this code will be copied to on-chip memory and executed from there.
 */
	.balign 4
ENTRY(sh_mobile_sleep_enter_start)

	/* save mode flags */
	mov.l	r4, @(SH_SLEEP_MODE, r5)

	/* save original vbr */
	stc	vbr, r0
	mov.l	r0, @(SH_SLEEP_VBR, r5)

	/* point vbr to our on-chip memory page */
	ldc	r5, vbr

	/* save return address */
	sts	pr, r0
	mov.l	r0, @(SH_SLEEP_SPC, r5)

	/* save sr */
	stc	sr, r0
	mov.l	r0, @(SH_SLEEP_SR, r5)

	/* save general purpose registers to stack if needed */
	mov.l	@(SH_SLEEP_MODE, r5), r0
	tst	#SUSP_SH_REGS, r0
	bt	skip_regs_save

	sts.l	pr, @-r15
	mov.l	r14, @-r15
	mov.l	r13, @-r15
	mov.l	r12, @-r15
	mov.l	r11, @-r15
	mov.l	r10, @-r15
	mov.l	r9, @-r15
	mov.l	r8, @-r15

	/* make sure bank0 is selected, save low registers */
	mov.l	rb_bit, r9
	not	r9, r9
	bsr	set_sr
	 mov	#0, r10

	bsr	save_low_regs
	 nop

	/* switch to bank 1, save low registers */
	mov.l	rb_bit, r10
	bsr	set_sr
	 mov	#-1, r9

	bsr	save_low_regs
	 nop

	/* switch back to bank 0 */

Annotation

Implementation Notes