linux内核中的__cpu_suspend是在哪里实现的呀?
Posted dakewei
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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)
以上是关于linux内核中的__cpu_suspend是在哪里实现的呀?的主要内容,如果未能解决你的问题,请参考以下文章
Linux 内核进程管理 ( Linux 内核中的进程状态 | TASK_RUNNING | TASK_INTERRUPTIBLE | __TASK_STOPPED | EXIT_ZOMBIE )