text: (window.webpackJsonp=window.webpackJsonp||[]).push([[9],{1544:function(t,r,s){"use strict";s.r(r);var a=s(1),n=Object(a.a)({},(function(){var t=this,r=t.$createElement,s=t._self._c||r;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("p",[t._v("子曰：“君子坦荡荡，小人长戚戚。” 《论语》：述而篇")]),t._v(" "),s("p",[s("a",{attrs:{href:"http://weharmonyos.com/",target:"_blank",rel:"noopener noreferrer"}},[s("img",{attrs:{src:"https://gitee.com/weharmonyos/resources/raw/master/common/io.png",alt:""}})])]),t._v(" "),s("p",[t._v("百篇博客分析.本篇为: (汇编基础篇) | CPU上班也要打卡")]),t._v(" "),s("p",[s("a",{attrs:{href:"/resource/%E9%B8%BF%E8%92%99%E5%86%85%E6%A0%B8%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90(%E7%99%BE%E7%AF%87%E5%8D%9A%E5%AE%A2%E5%88%86%E6%9E%90.%E6%8C%96%E9%80%8F%E9%B8%BF%E8%92%99%E5%86%85%E6%A0%B8).zip"}},[t._v("下载 >> 离线文档.鸿蒙内核源码分析(百篇博客分析.挖透鸿蒙内核).pdf")])]),t._v(" "),s("p",[t._v("硬件架构相关篇为:")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"http://weharmonyos.com/blog/22.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("v22.03 鸿蒙内核源码分析(汇编基础) | CPU上班也要打卡")])]),t._v(" "),s("li",[s("a",{attrs:{href:"http://weharmonyos.com/blog/23.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("v23.04 鸿蒙内核源码分析(汇编传参) | 如何传递复杂的参数")])]),t._v(" "),s("li",[s("a",{attrs:{href:"http://weharmonyos.com/blog/36.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("v36.05 鸿蒙内核源码分析(工作模式) | 程序界的韦小宝是谁")])]),t._v(" "),s("li",[s("a",{attrs:{href:"http://weharmonyos.com/blog/38.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("v38.06 鸿蒙内核源码分析(寄存器) | 讲真 全宇宙只佩服它")])]),t._v(" "),s("li",[s("a",{attrs:{href:"http://weharmonyos.com/blog/39.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("v39.06 鸿蒙内核源码分析(异常接管) | 社会很单纯 复杂的是人")])]),t._v(" "),s("li",[s("a",{attrs:{href:"http://weharmonyos.com/blog/40.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("v40.03 鸿蒙内核源码分析(汇编汇总) | 汇编可爱如邻家女孩")])]),t._v(" "),s("li",[s("a",{attrs:{href:"http://weharmonyos.com/blog/42.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("v42.05 鸿蒙内核源码分析(中断切换) | 系统因中断活力四射")])]),t._v(" "),s("li",[s("a",{attrs:{href:"http://weharmonyos.com/blog/43.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("v43.05 鸿蒙内核源码分析(中断概念) | 海公公的日常工作")])]),t._v(" "),s("li",[s("a",{attrs:{href:"http://weharmonyos.com/blog/44.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("v44.04 鸿蒙内核源码分析(中断管理) | 没中断太可怕")])])]),t._v(" "),s("p",[s("img",{attrs:{src:"https://gitee.com/weharmonyos/resources/raw/master/22/stack.png",alt:""}})]),t._v(" "),s("p",[t._v("本篇通过拆解一段很简单的汇编代码来快速认识汇编，为读懂鸿蒙汇编打基础.系列篇后续将逐个剖析鸿蒙的汇编文件.")]),t._v(" "),s("h3",{attrs:{id:"汇编很简单"}},[t._v("汇编很简单")]),t._v(" "),s("ul",[s("li",[s("p",[t._v("第一： 要认定汇编语言一定是简单的，没有高深的东西，无非就是数据的搬来搬去，运行时数据主要待在两个地方：内存和寄存器。寄存器是CPU内部存储器，离运算器最近，所以最快.")])]),t._v(" "),s("li",[s("p",[t._v("第二： 运行空间(栈空间)就是CPU打卡上班的地方，内核设计者规定谁请CPU上班由谁提供场地，用户程序提供的场地叫用户栈，敏感工作CPU要带回公司做，公司提供的场地叫内核栈，敏感工作叫系统调用，系统调用的本质理解是CPU要切换工作模式即切换办公场地。")])]),t._v(" "),s("li",[s("p",[t._v("第三：CPU的工作顺序是流水线的，它只认指令，而且只去一个地方（指向代码段的PC寄存器）拿指令运算消化。指令集是告诉外界我CPU能干什么活并提供对话指令，汇编语言是人和CPU能愉快沟通不拧巴的共识语言。一一对应了CPU指令，又能确保记性不好的人类能模块化的设计idea， 先看一段C编译成汇编代码再来说模块化。")])])]),t._v(" "),s("h3",{attrs:{id:"square-c-汇编"}},[t._v("square(c -> 汇编)")]),t._v(" "),s("div",{staticClass:"language-c line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-c"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//编译器: armv7-a clang (trunk)")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//++++++++++++ square(c -> 汇编)++++++++++++++++++++++++")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" a，"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v("b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v("， "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n        sub     sp， sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("     @sp减去"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("，意思为给square分配栈空间，只用"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),t._v("个栈空间完成计算\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @第一个参数入栈\n        str     r1， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @第二个参数入栈\n        ldr     r1， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @取出第一个参数给r1\n        ldr     r2， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @取出第二个参数给r2\n        mul     r0， r1， r2     @执行a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v("b给R0，返回值的工作一直是交给R0的\n        add     sp， sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("     @函数执行完了，要释放申请的栈空间\n        bx      lr             @子程序返回，等同于mov pc，lr，即跳到调用处\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br"),s("span",{staticClass:"line-number"},[t._v("5")]),s("br"),s("span",{staticClass:"line-number"},[t._v("6")]),s("br"),s("span",{staticClass:"line-number"},[t._v("7")]),s("br"),s("span",{staticClass:"line-number"},[t._v("8")]),s("br"),s("span",{staticClass:"line-number"},[t._v("9")]),s("br"),s("span",{staticClass:"line-number"},[t._v("10")]),s("br"),s("span",{staticClass:"line-number"},[t._v("11")]),s("br"),s("span",{staticClass:"line-number"},[t._v("12")]),s("br"),s("span",{staticClass:"line-number"},[t._v("13")]),s("br"),s("span",{staticClass:"line-number"},[t._v("14")]),s("br")])]),s("h3",{attrs:{id:"fp-c-汇编"}},[t._v("fp(c -> 汇编)")]),t._v(" "),s("div",{staticClass:"language-c line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-c"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//++++++++++++ fp(c -> 汇编)++++++++++++++++++++++++")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" a "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("b，a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n        push    "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("r11， lr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("      @"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("r11")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("fp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("lr入栈，保存调用者main的位置\n        mov     r11， sp        @r11用于保存sp值，函数栈开始位置 \n        sub     sp， sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("     @sp减去"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("，意思为给fp分配栈空间，只用"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),t._v("个栈空间完成计算\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @先保存参数值，放在SP"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),t._v("，此时r0中存放的是参数\n        mov     r0， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("         @r0"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @再把"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("也保存在SP的位置\n        ldr     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @把SP的值给R0\n        ldr     r1， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @把SP"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),t._v("的值给R1\n        add     r1， r0， r1     @执行r1"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("b\n        mov     r0， r1         @r0"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("r1，用r0，r1传参\n        bl      "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v("， "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("@先mov lr， pc 再mov pc "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v("， "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("   \n        mov     sp， r11        @函数执行完了，要释放申请的栈空间 \n        pop     "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("r11， lr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("      @弹出r11和lr，lr是专用标签，弹出就自动复制给lr寄存器\n        bx      lr             @子程序返回，等同于mov pc，lr，即跳到调用处\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br"),s("span",{staticClass:"line-number"},[t._v("5")]),s("br"),s("span",{staticClass:"line-number"},[t._v("6")]),s("br"),s("span",{staticClass:"line-number"},[t._v("7")]),s("br"),s("span",{staticClass:"line-number"},[t._v("8")]),s("br"),s("span",{staticClass:"line-number"},[t._v("9")]),s("br"),s("span",{staticClass:"line-number"},[t._v("10")]),s("br"),s("span",{staticClass:"line-number"},[t._v("11")]),s("br"),s("span",{staticClass:"line-number"},[t._v("12")]),s("br"),s("span",{staticClass:"line-number"},[t._v("13")]),s("br"),s("span",{staticClass:"line-number"},[t._v("14")]),s("br"),s("span",{staticClass:"line-number"},[t._v("15")]),s("br"),s("span",{staticClass:"line-number"},[t._v("16")]),s("br"),s("span",{staticClass:"line-number"},[t._v("17")]),s("br"),s("span",{staticClass:"line-number"},[t._v("18")]),s("br"),s("span",{staticClass:"line-number"},[t._v("19")]),s("br"),s("span",{staticClass:"line-number"},[t._v("20")]),s("br"),s("span",{staticClass:"line-number"},[t._v("21")]),s("br")])]),s("h3",{attrs:{id:"main-c-汇编"}},[t._v("main(c -> 汇编)")]),t._v(" "),s("div",{staticClass:"language-c line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-c"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//++++++++++++ main(c -> 汇编)++++++++++++++++++++++++")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("main")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" sum "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" a "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("a "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("100")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("++")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n        sum "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" sum "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" sum"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\nmain"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n        push    "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("r11， lr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("      @"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("r11")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("fp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("/")]),t._v("lr入栈，保存调用者的位置\n        mov     r11， sp        @r11用于保存sp值，函数栈开始位置\n        sub     sp， sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("16")]),t._v("    @sp减去"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("16")]),t._v("，意思为给main分配栈空间，只用"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),t._v("个栈空间完成计算\n        mov     r0， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),t._v("         @初始化r0\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("r11， #"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("-")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" @执行sum "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),t._v("\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @sum将始终占用SP"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("的位置\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @a将始终占用SP"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),t._v("的位置\n        b       "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_1        @跳到循环开始位置\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_1"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("                       @循环开始位置入口\n        ldr     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @取出a的值给r0\n        cmp     r0， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("99")]),t._v("        @跟"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("99")]),t._v("比较\n        bgt     "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_4        @大于"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("99")]),t._v("，跳出循环 mov pc "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_4\n        b       "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_2        @继续循环，直接 mov pc "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_2\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_2"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("                       @符合循环条件入口\n        ldr     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @取出sum的值给r0，sp"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("用于写SUM的值\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @先保存SUM的值，SP的位置用于读SUM值\n        ldr     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @r0用于传参，取出A的值给r0作为fp的参数\n        bl      "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("        @先mov lr， pc再mov pc "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n        mov     r1， r0         @fp的返回值为r0，保存到r1\n        ldr     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @取出SUM的值\n        add     r0， r0， r1     @计算新sum的值，由R0保存\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @将新sum保存到SP"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("的位置\n        b       "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_3        @无条件跳转，直接 mov pc "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_3\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_3"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("                       @完成a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("++")]),t._v("操作入口\n        ldr     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @SP"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),t._v("中记录是a的值，赋给r0\n        add     r0， r0， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("     @r0增加"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @把新的a值放回SP"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),t._v("里去\n        b       "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_1        @跳转到比较 a "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("100")]),t._v(" 处\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LBB1_4"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("                       @循环结束入口\n        ldr     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @最后SUM的结果给R0，返回值的工作一直是交给R0的\n        mov     sp， r11        @函数执行完了，要释放申请的栈空间\n        pop     "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("r11， lr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("      @弹出r11和lr，lr是专用标签，弹出就自动复制给lr寄存器\n        bx      lr             @子程序返回，跳转到lr处等同于 MOV PC， LR\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br"),s("span",{staticClass:"line-number"},[t._v("5")]),s("br"),s("span",{staticClass:"line-number"},[t._v("6")]),s("br"),s("span",{staticClass:"line-number"},[t._v("7")]),s("br"),s("span",{staticClass:"line-number"},[t._v("8")]),s("br"),s("span",{staticClass:"line-number"},[t._v("9")]),s("br"),s("span",{staticClass:"line-number"},[t._v("10")]),s("br"),s("span",{staticClass:"line-number"},[t._v("11")]),s("br"),s("span",{staticClass:"line-number"},[t._v("12")]),s("br"),s("span",{staticClass:"line-number"},[t._v("13")]),s("br"),s("span",{staticClass:"line-number"},[t._v("14")]),s("br"),s("span",{staticClass:"line-number"},[t._v("15")]),s("br"),s("span",{staticClass:"line-number"},[t._v("16")]),s("br"),s("span",{staticClass:"line-number"},[t._v("17")]),s("br"),s("span",{staticClass:"line-number"},[t._v("18")]),s("br"),s("span",{staticClass:"line-number"},[t._v("19")]),s("br"),s("span",{staticClass:"line-number"},[t._v("20")]),s("br"),s("span",{staticClass:"line-number"},[t._v("21")]),s("br"),s("span",{staticClass:"line-number"},[t._v("22")]),s("br"),s("span",{staticClass:"line-number"},[t._v("23")]),s("br"),s("span",{staticClass:"line-number"},[t._v("24")]),s("br"),s("span",{staticClass:"line-number"},[t._v("25")]),s("br"),s("span",{staticClass:"line-number"},[t._v("26")]),s("br"),s("span",{staticClass:"line-number"},[t._v("27")]),s("br"),s("span",{staticClass:"line-number"},[t._v("28")]),s("br"),s("span",{staticClass:"line-number"},[t._v("29")]),s("br"),s("span",{staticClass:"line-number"},[t._v("30")]),s("br"),s("span",{staticClass:"line-number"},[t._v("31")]),s("br"),s("span",{staticClass:"line-number"},[t._v("32")]),s("br"),s("span",{staticClass:"line-number"},[t._v("33")]),s("br"),s("span",{staticClass:"line-number"},[t._v("34")]),s("br"),s("span",{staticClass:"line-number"},[t._v("35")]),s("br"),s("span",{staticClass:"line-number"},[t._v("36")]),s("br"),s("span",{staticClass:"line-number"},[t._v("37")]),s("br"),s("span",{staticClass:"line-number"},[t._v("38")]),s("br"),s("span",{staticClass:"line-number"},[t._v("39")]),s("br"),s("span",{staticClass:"line-number"},[t._v("40")]),s("br"),s("span",{staticClass:"line-number"},[t._v("41")]),s("br"),s("span",{staticClass:"line-number"},[t._v("42")]),s("br"),s("span",{staticClass:"line-number"},[t._v("43")]),s("br")])]),s("p",[t._v("代码有点长，都加了注释，如果能直接看懂那么恭喜你，鸿蒙内核的6个汇编文件基于也就懂了。这是以下C文件全貌")]),t._v(" "),s("h3",{attrs:{id:"文件全貌"}},[t._v("文件全貌")]),t._v(" "),s("div",{staticClass:"language-c line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-c"}},[s("code",[s("span",{pre:!0,attrs:{class:"token macro property"}},[s("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),s("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("include")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("<stdio.h>")])]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token macro property"}},[s("span",{pre:!0,attrs:{class:"token directive-hash"}},[t._v("#")]),s("span",{pre:!0,attrs:{class:"token directive keyword"}},[t._v("include")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v("<math.h>")])]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" a，"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v("b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" a "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("b，a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("main")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" sum "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" a "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("a "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("100")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v(" a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("++")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n        sum "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" sum "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("fp")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" sum"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br"),s("span",{staticClass:"line-number"},[t._v("5")]),s("br"),s("span",{staticClass:"line-number"},[t._v("6")]),s("br"),s("span",{staticClass:"line-number"},[t._v("7")]),s("br"),s("span",{staticClass:"line-number"},[t._v("8")]),s("br"),s("span",{staticClass:"line-number"},[t._v("9")]),s("br"),s("span",{staticClass:"line-number"},[t._v("10")]),s("br"),s("span",{staticClass:"line-number"},[t._v("11")]),s("br"),s("span",{staticClass:"line-number"},[t._v("12")]),s("br"),s("span",{staticClass:"line-number"},[t._v("13")]),s("br"),s("span",{staticClass:"line-number"},[t._v("14")]),s("br"),s("span",{staticClass:"line-number"},[t._v("15")]),s("br"),s("span",{staticClass:"line-number"},[t._v("16")]),s("br"),s("span",{staticClass:"line-number"},[t._v("17")]),s("br"),s("span",{staticClass:"line-number"},[t._v("18")]),s("br"),s("span",{staticClass:"line-number"},[t._v("19")]),s("br"),s("span",{staticClass:"line-number"},[t._v("20")]),s("br"),s("span",{staticClass:"line-number"},[t._v("21")]),s("br")])]),s("p",[t._v("代码很简单谁都能看懂，代码很典型，具有代表性，有循环，有判断，有运算，有多级函数调用。编译后的汇编代码基本和C语言的结构差不太多，\n区别是对循环的实现用了四个模块，四个模块也好理解:\n一个是开始块(LBB1_1)， 一个符合条件的处理块(LBB1_2)，一个条件发生变化块(LBB1_3)，最后收尾块(LBB1_4).")]),t._v(" "),s("p",[t._v("按块逐一剖析.")]),t._v(" "),s("h3",{attrs:{id:"先看最短的那个"}},[t._v("先看最短的那个")]),t._v(" "),s("div",{staticClass:"language-c line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-c"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" a，"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v(" b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n    "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v("b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//编译成")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v("， "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v("\n        sub     sp， sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("     @sp减去"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("，意思为给square分配栈空间，只用"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("2")]),t._v("个栈空间完成计算\n        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @第一个参数入栈\n        str     r1， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @第二个参数入栈\n        ldr     r1， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @取出第一个参数给r1\n        ldr     r2， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @取出第二个参数给r2\n        mul     r0， r1， r2     @执行a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v("b给R0，返回值的工作一直是交给R0的\n        add     sp， sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("8")]),t._v("     @函数执行完了，要释放申请的栈空间\n        bx      lr             @子程序返回，等同于mov pc，lr，即跳到调用处\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br"),s("span",{staticClass:"line-number"},[t._v("5")]),s("br"),s("span",{staticClass:"line-number"},[t._v("6")]),s("br"),s("span",{staticClass:"line-number"},[t._v("7")]),s("br"),s("span",{staticClass:"line-number"},[t._v("8")]),s("br"),s("span",{staticClass:"line-number"},[t._v("9")]),s("br"),s("span",{staticClass:"line-number"},[t._v("10")]),s("br"),s("span",{staticClass:"line-number"},[t._v("11")]),s("br"),s("span",{staticClass:"line-number"},[t._v("12")]),s("br"),s("span",{staticClass:"line-number"},[t._v("13")]),s("br")])]),s("p",[t._v("首先上来一句 sub  sp， sp， #8 等同于 sp = sp - 8 ，CPU运行需要场地，这个场地就是栈 ，SP是指向栈的指针，表示此时用栈的刻度. 代码和鸿蒙内核用栈方式一样，都采用了递减满栈的方式(FD).\n什么是递减满栈? 递减指的是栈底地址高于栈顶地址，栈的生长方向是递减的， 满栈指的是SP指针永远指向栈顶. 每个函数都有自己独立的栈底和栈顶，之间的空间统称栈帧.可以理解为分配了一块\n区域给函数运行，sub  sp， sp， #8 代表申请2个栈空间，一个栈空间按四个字节算.\n用完要不要释放?当然要，add     sp， sp， #8 就是释放栈空间. 是一对的，减了又加回去，空间就归还了.\nldr     r1， [sp， #4] 的意思是取出SP+4这个虚拟地址的值给r1寄存器，而SP的指向并没有改变的，还是在栈顶， 为什么要+呢， +就是往回数， 定位到分配的栈空间上."),s("br"),t._v("\n一定要理解递减满栈，这是关键! 否则读不懂内核汇编代码.")]),t._v(" "),s("h3",{attrs:{id:"入参方式"}},[t._v("入参方式")]),t._v(" "),s("p",[t._v("一般都是通过寄存器(r0..r10)传参，fp调用square之前会先将参数给(r0..r10)")]),t._v(" "),s("div",{staticClass:"language-c line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-c"}},[s("code",[t._v("        add     r1， r0， r1     @执行r1"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+")]),t._v("b\n        mov     r0， r1         @r0"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v("r1，用r0，r1传参\n        bl      "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v("， "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("@先mov lr， pc 再mov pc "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("square")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),t._v("， "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("int")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" \n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br")])]),s("p",[t._v("到了square中后，先让 r0，r1入栈，目的是保存参数值， 因为 square中要用r0，r1 ，")]),t._v(" "),s("div",{staticClass:"language-c line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-c"}},[s("code",[t._v("        str     r0， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @先入栈保存第一个参数\n        str     r1， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @再入栈保存第二个参数\n        ldr     r1， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @再取出第一个参数给r1，"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v("b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("中a值\n        ldr     r2， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @再取出第二个参数给r2，用于计算 "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("a"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),t._v("b"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("中b值\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br"),s("span",{staticClass:"line-number"},[t._v("4")]),s("br")])]),s("p",[t._v("是不是感觉这段汇编很傻，直接不保存计算不就完了吗，这个是流程问题，编译器统一先保存参数，至于你想怎么用它不管，也管不了.\n另外返回值都是默认统一给r0保存. square中将(a*b)的结果给了r0，回到fp中取出R0对fp来说这就是square的返回值，这是规定.")]),t._v(" "),s("p",[s("strong",[t._v("函数调用")]),t._v("\nmain 和 fp 中都需要调用其他函数，所以都出现了")]),t._v(" "),s("div",{staticClass:"language-c line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-c"}},[s("code",[t._v("        push    "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("r11， lr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n        "),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("//....")]),t._v("\n        pop     "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("r11， lr"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br"),s("span",{staticClass:"line-number"},[t._v("3")]),s("br")])]),s("p",[t._v("这哥俩也是成对出现的，这是函数调用的必备装备，作用是保存和恢复调用者的现场，例如 main -> fp， fp要保存main的栈帧范围和指令位置， lr保存的是main函数执行到哪个指令的位置， r11的作用是指向main的栈顶位置，如此fp执行完后return回main的时候，先mov pc，lr， PC寄存器的值一变， 表示执行的代码就变了，又回到了main的指令和栈帧继续未完成的事业.")]),t._v(" "),s("p",[s("strong",[t._v("内存和寄存器数据怎么搬?")])]),t._v(" "),s("p",[t._v("数据主要待在两个地方：内存和寄存器. 寄存器<->寄存器 ， 内存<->寄存器 ， 内存<->内存 搬运指令都不一样.")]),t._v(" "),s("div",{staticClass:"language-c line-numbers-mode"},[s("pre",{pre:!0,attrs:{class:"language-c"}},[s("code",[t._v("        str     r1， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("       @ 寄存器"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("->")]),t._v("内存\n        ldr     r1， "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("sp， #"),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("4")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("   @ 内存"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("->")]),t._v("寄存器\n")])]),t._v(" "),s("div",{staticClass:"line-numbers-wrapper"},[s("span",{staticClass:"line-number"},[t._v("1")]),s("br"),s("span",{staticClass:"line-number"},[t._v("2")]),s("br")])]),s("p",[t._v("这又是一对，用于 内存<->寄存器之间，熟知的 mov r0， r1 用于 寄存器<->寄存器")]),t._v(" "),s("h3",{attrs:{id:"追问三个问题"}},[t._v("追问三个问题")]),t._v(" "),s("p",[t._v("第一:如果是可变参数怎么办? 100个参数怎么整， 通过寄存器总共就12个，不够传参啊")]),t._v(" "),s("p",[t._v("第二:返回值可以有多个吗?")]),t._v(" "),s("p",[t._v("第三:数据搬运可以不经过CPU吗?")]),t._v(" "),s("h3",{attrs:{id:"百文说内核-脉络渐清晰"}},[t._v("百文说内核.脉络渐清晰")]),t._v(" "),s("p",[t._v("发布站点 (鸿蒙研究站 | 开源中国 | 博客园 | 51cto | csdn | 知乎 | 掘金)")]),t._v(" "),s("p",[t._v("按功能模块:")]),t._v(" "),s("ul",[s("li",[t._v("前因后果 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/08.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("总目录")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/09.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("调度故事")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/10.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("内存主奴")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/13.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("源码注释")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/18.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("源码结构")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/52.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("静态站点")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/73.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("参考文档")]),t._v(" |")]),t._v(" "),s("li",[t._v("基础工具 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/01.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("双向链表")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/19.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("位图管理")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/20.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("用栈方式")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/31.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("定时器")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/34.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("原子操作")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/35.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("时间管理")]),t._v(" |")]),t._v(" "),s("li",[t._v("加载运行 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/51.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("ELF格式")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/53.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("ELF解析")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/54.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("静态链接")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/55.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("重定位")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/56.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("进程映像")]),t._v(" |")]),t._v(" "),s("li",[t._v("进程管理 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/02.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("进程管理")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/24.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("进程概念")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/45.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("Fork")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/46.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("特殊进程")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/47.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("进程回收")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/48.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("信号生产")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/49.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("信号消费")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/71.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("Shell编辑")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/72.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("Shell解析")]),t._v(" |")]),t._v(" "),s("li",[t._v("编译构建 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/50.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("编译环境")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/57.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("编译过程")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/58.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("环境脚本")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/59.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("构建工具")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/60.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("gn应用")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/61.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("忍者ninja")]),t._v(" |")]),t._v(" "),s("li",[t._v("进程通讯 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/26.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("自旋锁")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/27.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("互斥锁")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/28.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("进程通讯")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/29.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("信号量")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/30.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("事件控制")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/33.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("消息队列")]),t._v(" |")]),t._v(" "),s("li",[t._v("内存管理 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/11.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("内存分配")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/12.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("内存管理")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/14.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("内存汇编")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/15.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("内存映射")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/16.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("内存规则")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/17.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("物理内存")]),t._v(" |")]),t._v(" "),s("li",[t._v("任务管理 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/03.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("时钟任务")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/04.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("任务调度")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/05.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("任务管理")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/06.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("调度队列")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/07.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("调度机制")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/21.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("线程概念")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/25.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("并发并行")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/32.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("CPU")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/37.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("系统调用")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/41.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("任务切换")]),t._v(" |")]),t._v(" "),s("li",[t._v("文件系统 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/62.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("文件概念")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/63.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("文件系统")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/64.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("索引节点")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/65.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("挂载目录")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/66.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("根文件系统")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/68.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("VFS")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/69.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("文件句柄")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/70.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("管道文件")]),t._v(" |")]),t._v(" "),s("li",[t._v("硬件架构 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/22.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("汇编基础")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/23.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("汇编传参")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/36.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("工作模式")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/38.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("寄存器")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/39.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("异常接管")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/40.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("汇编汇总")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/42.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("中断切换")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/43.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("中断概念")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/44.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("中断管理")]),t._v(" |")]),t._v(" "),s("li",[t._v("I/O设备 >> "),s("a",{attrs:{href:"http://weharmonyos.com/blog/67.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("字符设备")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/74.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("控制台")]),t._v(" | "),s("a",{attrs:{href:"http://weharmonyos.com/blog/75.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("远程登录")]),t._v(" |")])]),t._v(" "),s("h3",{attrs:{id:"百万注源码-处处扣细节"}},[t._v("百万注源码.处处扣细节")]),t._v(" "),s("p",[s("a",{attrs:{href:"https://gitee.com/weharmony/kernel_liteos_a_note",target:"_blank",rel:"noopener noreferrer"}},[t._v("< gitee")]),t._v(" | "),s("a",{attrs:{href:"https://github.com/kuangyufei/kernel_liteos_a_note",target:"_blank",rel:"noopener noreferrer"}},[t._v("github")]),t._v(" | "),s("a",{attrs:{href:"https://weharmony.coding.net/public/harmony/kernel_liteos_a_note/git/files",target:"_blank",rel:"noopener noreferrer"}},[t._v("coding")]),t._v(" | "),s("a",{attrs:{href:"https://codechina.csdn.net/kuangyufei/kernel_liteos_a_note",target:"_blank",rel:"noopener noreferrer"}},[t._v("codechina >")]),t._v(" 四大码仓推送 | 同步官方源码")]),t._v(" "),s("p",[s("a",{attrs:{href:"https://gitee.com/weharmony/kernel_liteos_a_note",target:"_blank",rel:"noopener noreferrer"}},[s("img",{attrs:{src:"https://gitee.com/weharmony/kernel_liteos_a_note/widgets/widget_card.svg?colors=393222,ebdfc1,fffae5,d8ca9f,393222,a28b40",alt:""}})])]),t._v(" "),s("h3",{attrs:{id:"关注不迷路-代码即人生"}},[t._v("关注不迷路.代码即人生")]),t._v(" "),s("p",[s("img",{attrs:{src:"https://gitee.com/weharmonyos/resources/raw/master/common/so1so.png",alt:""}})]),t._v(" "),s("p",[t._v("鸿蒙研究站( weharmonyos ) | 每天死磕一点点，原创不易，欢迎转载，请注明出处。若能支持点赞则更佳，感谢每一份支持。")])])}),[],!1,null,null,null);r.default=n.exports}}]);