zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    Extjs面板和布局初探
    XAMPP下apache部署网站,多个虚拟机(空间)配置
    安全配置织梦系统初探参考[转载]
    windows系统如何真正隐藏文件夹[转载]
    Siamese-RPN论文阅读
    线段树求和
    算法要点随记
    map使用示例
    算法准备之c++ sort使用示例
    编程要点随记
  • 原文地址:https://www.cnblogs.com/dakewei/p/11328957.html
Copyright © 2011-2022 走看看