linux内核中的__cpu_suspend是在哪里实现的呀?

1. 内核版本

  4.19

2. 在arch/arm/kernel/sleep.S中实现如下:

/*
 * Save CPU state for a suspend.  This saves the CPU general purpose
 * registers, and allocates space on the kernel stack to save the CPU
 * specific registers and some other data for resume.
 *  r0 = suspend function arg0
 *  r1 = suspend function
 *  r2 = MPIDR value the resuming CPU will use
 */
ENTRY(__cpu_suspend)
        stmfd   sp!, {r4 - r11, lr}
#ifdef MULTI_CPU
        ldr     r10, =processor
        ldr     r4, [r10, #CPU_SLEEP_SIZE] @ size of CPU sleep state
#else
        ldr     r4, =cpu_suspend_size
#endif
        mov     r5, sp                  @ current virtual SP
        add     r4, r4, #12             @ Space for pgd, virt sp, phys resume fn
        sub     sp, sp, r4              @ allocate CPU state on stack
        ldr     r3, =sleep_save_sp
        stmfd   sp!, {r0, r1}           @ save suspend func arg and pointer
        ldr     r3, [r3, #SLEEP_SAVE_SP_VIRT]
        ALT_SMP(ldr r0, =mpidr_hash)
        ALT_UP_B(1f)
        /* This ldmia relies on the memory layout of the mpidr_hash struct */
        ldmia   r0, {r1, r6-r8} @ r1 = mpidr mask (r6,r7,r8) = l[0,1,2] shifts
        compute_mpidr_hash      r0, r6, r7, r8, r2, r1
        add     r3, r3, r0, lsl #2
1:      mov     r2, r5                  @ virtual SP
        mov     r1, r4                  @ size of save block
        add     r0, sp, #8              @ pointer to save block
        bl      __cpu_suspend_save
        badr    lr, cpu_suspend_abort
        ldmfd   sp!, {r0, pc}           @ call suspend fn
ENDPROC(__cpu_suspend)

 

转载于:https://www.cnblogs.com/dakewei/p/11328957.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值