《最新处理器的14幻灯片.ppt》由会员分享,可在线阅读,更多相关《最新处理器的14幻灯片.ppt(34页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、进入夏天,少不了一个热字当头,电扇空调陆续登场,每逢此时,总会进入夏天,少不了一个热字当头,电扇空调陆续登场,每逢此时,总会想起那一把蒲扇。蒲扇,是记忆中的农村,夏季经常用的一件物品。记想起那一把蒲扇。蒲扇,是记忆中的农村,夏季经常用的一件物品。记忆中的故乡,每逢进入夏天,集市上最常见的便是蒲扇、凉席,不论男女老忆中的故乡,每逢进入夏天,集市上最常见的便是蒲扇、凉席,不论男女老少,个个手持一把,忽闪忽闪个不停,嘴里叨叨着少,个个手持一把,忽闪忽闪个不停,嘴里叨叨着“怎么这么热怎么这么热”,于是三,于是三五成群,聚在大树下,或站着,或随即坐在石头上,手持那把扇子,边唠嗑五成群,聚在大树下,或站着
2、,或随即坐在石头上,手持那把扇子,边唠嗑边乘凉。孩子们却在周围跑跑跳跳,热得满头大汗,不时听到边乘凉。孩子们却在周围跑跑跳跳,热得满头大汗,不时听到“强子,别跑强子,别跑了,快来我给你扇扇了,快来我给你扇扇”。孩子们才不听这一套,跑个没完,直到累气喘吁吁,。孩子们才不听这一套,跑个没完,直到累气喘吁吁,这才一跑一踮地围过了,这时母亲总是,好似生气的样子,边扇边训,这才一跑一踮地围过了,这时母亲总是,好似生气的样子,边扇边训,“你你看热的,跑什么?看热的,跑什么?”此时这把蒲扇,是那么凉快,那么的温馨幸福,有母亲此时这把蒲扇,是那么凉快,那么的温馨幸福,有母亲的味道!蒲扇是中国传统工艺品,在我国
3、已有三千年多年的历史。取材的味道!蒲扇是中国传统工艺品,在我国已有三千年多年的历史。取材于棕榈树,制作简单,方便携带,且蒲扇的表面光滑,因而,古人常会在上于棕榈树,制作简单,方便携带,且蒲扇的表面光滑,因而,古人常会在上面作画。古有棕扇、葵扇、蒲扇、蕉扇诸名,实即今日的蒲扇,江浙称之为面作画。古有棕扇、葵扇、蒲扇、蕉扇诸名,实即今日的蒲扇,江浙称之为芭蕉扇。六七十年代,人们最常用的就是这种,似圆非圆,轻巧又便宜的蒲芭蕉扇。六七十年代,人们最常用的就是这种,似圆非圆,轻巧又便宜的蒲扇。蒲扇流传至今,我的记忆中,它跨越了半个世纪,也走过了我们的扇。蒲扇流传至今,我的记忆中,它跨越了半个世纪,也走过
4、了我们的半个人生的轨迹,携带着特有的念想,一年年,一天天,流向长长的时间隧半个人生的轨迹,携带着特有的念想,一年年,一天天,流向长长的时间隧道,袅道,袅2*OutlinenuC/OS-II PortingnMulticore BootnDemo SMP uC/OS-II9*nvoid OSCpuInit()nnintIntNo;nInitA20();/ Enable address line 20nInitPIC();/ Relocate IRQs to 0 x20-0 x2Fn/ Install a default handler for all supported interrupts:n
5、/a) 0 x00-0 x1F: Intel-reservedn/b) 0 x20-0 x2F: IRQ (relocated)n/c) 0 x30-0 x3F: Available for uCOS and application.nfor (IntNo = 0; IntNo OSTCBStkPtr; OSRunning = TRUE; Restore all processor registers from the new tasks stack; Execute a return from interrupt instruction;18*nOSStartHighRdy ncall _O
6、STaskSwHook ; Call OSTaskSwHook();OSRunning = TRUEnmov eax, 1hnmov _OSRunning , eaxLoad the processor stack pointer with OSTCBHighRdy-OSTCBStkPtrnmov eax,_OSTCBHighRdy nmov esp,eaxPop all the processor registers from the stacknpopad Execute a Return from interrupt intructionniretdOS_CPU_A.asm - OSSt
7、artHighRdy(2/3)19*n若是此函式完成後可以觀察到taskA的動作若是沒有預期動作,則表示先前的準備工作尚未全部完成Ex.bootloader、OS_CPU.hOS_CPU_A.asm - OSStartHighRdy(3/3)20*OS_CPU_A.asm - OSCtxSw(1/4)nOSCtxSw()若是目前task ready queue中有更高priority的task,則使用此函式將目前正在執行的task與之交換Pseudo codenvoid OSCtxSw(void)n 保存處理器暫存器; 將當前 task 的堆疊指標保存到當前 task 的 OS_TCB 中:
8、OSTCBCur-OSTCBStkPtr = Stack pointer; 呼叫使用者定義的 OSTaskSwHook(); OSTCBCur = OSTCBHighRdy; OSPrioCur = OSPrioHighRdy; 得到需要恢復的 task 的堆疊指標: Stack pointer = OSTCBHighRdy-OSTCBStkPtr; 將所有處理器暫存器從新 task 的堆疊中恢復出來; 執行中斷返回指令;n21*nOSCtxSw保存處理器暫存器 npushadOSTCBCur-OSTCBStkPtr = Stack pointernmov eax,_OSTCBCurnmov
9、eax,esp; Stack pointer is ESPOS_CPU_A.asm - OSCtxSw(2/4)22*呼叫使用者定義的 OSTaskSwHook() ncall_OSTaskSwHook OSTCBCur = OSTCBHighRdy nmov al,_OSPrioHighRdy ; AL is OSPrioHighRdynmov _OSPrioCur,alOSPrioCur = OSTCBHighRdynmov eax,_OSTCBHighRdy ; EAX is OSTCBHighRdynmov _OSTCBCur,eaxOS_CPU_A.asm - OSCtxSw(3/4
10、)23*Stack pointer = OSTCBHighRdy-OSTCBStkPtrnmov esp,eax; ESP = OSTCBHighRdy-OSTCBStkPtr將所有處理器暫存器從新 task 的堆疊中恢復出來執行中斷返回指令npopadniretdn此函式成功,則在taskA動作結束後,taskB會隨之動作OS_CPU_A.asm - OSCtxSw(4/4)24*OS_CPU_A.asm - OSTickISRnOSTickISR保存處理器暫存器npushadSend an end-of-interrupt to the i8259nmoval,20hnout20h,al
11、呼叫 OSIntEnter() 或者直接將 OSIntNesting 加 1ncall_OSIntEnter呼叫 OSTimeTick()ncall_OSTimeTick呼叫 OSIntExit()ncall_OSIntExit恢復處理器暫存器npopad執行中斷返回指令niretdn此函式完成後,可以在此函式中加入輸出, 若是此輸出可以依照interval持續到來,表示成功25*Multicore BootnMulticoreBSP (Bootstrap Processor) AP (Application Processor) nHow to boot AP (Application Pr
12、ocessor) ?Disable 8259Initialize Local APICInitialize I/O APIC26*CPU 1CPU 2CPU 3Local APIC 0Local APIC 1Local APIC 2Interrupt8259I/OAPICIMCRBSPAPAPNMILINTIN1LINTIN0RESETICC BUSINTPIC Mode27*Interrupt ModeCPU 1CPU 2CPU 3Local APIC 0Local APIC 1Local APIC 2Interrupt8259I/OAPICIMCRBSPAPAPNMILINTIN1LINT
13、IN0RESETICC BUSAPIC ModeINT28*nDisable 8259It means leave PIC modenIMCR ( Interrupt Mode Control Register)Write 0 x70 on 0 x22 (choose IMCR)Write 0 x01 on 0 x23 (not use PIC mode)Disable(mask) 8259 all IRQ pinsMulticore Boot29*nIntel specBSP初始化過程初始化過程1. 初始化memory2. Load microcode到處理器3. 初始化內存範圍寄存器(MT
14、RRs)4. enable cache5. 確定BSP是否是GenuineIntel6. 執行CPUID,保存CPU信息為將來使用7. load AP的啟動代碼到低1M的一個4K的頁裡8. 切換到保護模式9. 轉換4K的頁基址為一個8位的向量. 例如 0 x000BD000H - 0 xBDH10.設置APIC的SVR的bit8來enable local APIC11.建立錯誤處理handler12.初始化鎖信號量13.探測系統中的AP, 方法如下: - 設置處理器COUNT為1 - 啟動一個timer,BSP開始等待 - 此時AP開始初始化,並將COUNT加1 - timer到期,BSP檢查
15、COUNT,如果沒有增加,就表示系統中沒有AP.14. 等timer中斷,檢查COUNT並建立處理器數目AP初始化初始化1. 獲取信號量,開始初始化2. load microcode到處理器3. 初始化內存範圍寄存器(MTRRs)4. enable cache5. 檢查AP是否是GenuineIntel6. 保存CPUID信息,為將來使用7. 切換到保護模式8. 配置AP的共存內存接口執行環境9. 將處理器個數加110.釋放信號量11. 執行CLI並且進入halt狀態12.等待INIT IPIMulticore Boot30*nBroadcasts an INIT-SIPI-SIPI IPI
16、sequence to the APs to wake them up and initialize send twice IPI (Inter-Processor Interrupt) (INIT)nmake AP initialize nset AP Arb ID registerbroadcast SIPI (start-up IPI)nNumber of times depend on CPU nTell AP the address where it start executeMulticore Boot31*Demo32*Questions?/3233aMdPgSkVnYq$t*x
17、-A1D5G8JbNeQiTlWo#r%u(y+B2E6H9LcOfRjUmXp!s&w)z0C4F7IaMdPhSkVnZq$t*x-A2D5G8KbNeQiTlXo#r%v(y+B3E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