码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2019-08-09 19:46:09      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:resume   out   ash   min   reg   sso   tac   size   other   

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)

 

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

标签:resume   out   ash   min   reg   sso   tac   size   other   

原文地址:https://www.cnblogs.com/dakewei/p/11328957.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!