<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > ARM的System Mode

ARM的System Mode

作者: 時(shí)間:2016-11-10 來(lái)源:網(wǎng)絡(luò ) 收藏
ARM v4以后的版本里,ARM核都有7中工作模式:User, FIQ, IRQ, Supervisor, Abort, Undefined,和System。

7種processor mode又分為3類(lèi):

本文引用地址:http://dyxdggzs.com/article/201611/317216.htm

User mode

Privileged mode

system mode

對于System mode的作用一直有些模糊,今天在arm的網(wǎng)站上找到了一份說(shuō)明文檔,對這個(gè)問(wèn)題的解析很到位,特記錄如下:

The ARM Architecture defines a User mode that has 15 generalpurpose registers, a pc, and a CPSR.

除User Mode外,還有5種privileged modes

每一種Priviledged mode都有一個(gè)SPSRand a number of registers that replace some of the 15 User mode generalpurpose registers.

當exception發(fā)生時(shí):

the current PC is copied into the link register for the exception mode,

theCPSR is copied into the SPSR for the exception mode.

The CPSR isthen altered in an exception-dependent way, and the program counteris set to an exception-defined address to start the

exception handler.

BL指令copiesthe return address into r14 before changing the PC,so the subroutine return instruction moves r14 to pc (MOV pc,lr).

Together these actions imply that ARM modes that handle exceptionsmust ensure that another exception of the same type cannot

occurif they call subroutines, because the subroutine return addresswill be overwritten with the exception return address.

(要防止lr被覆蓋)

(In earlier versions of the ARM architecture, this problemhas been solved by either carefully avoiding subroutine calls inexception

code, or changing from the privileged mode to User mode.The first solution is often too restrictive, and the second meansthe task

may not have the privileged access it needs to run correctly.)

從ARMv4架構開(kāi)始,提供了system mode來(lái)解決lr覆蓋問(wèn)題.

System mode is a privileged processormode that shares the User mode registers. (與User Mode共用registers)

Privileged mode taskscan run in this mode, and exceptions no longer overwrite the linkregister.

注意:

System modecannot be entered by an exception.

The exceptionhandlers modify the CPSR to enter System mode. See Reentrant interrupt handlersfor an example.

就不逐字翻譯了,大體意思如下:

當處理器異常出現時(shí),當前程序計數器(也就是 PC+offset,offset與異常種類(lèi)相關(guān))會(huì )被拷貝的相應異常模式的LR,CPSR也會(huì )被拷貝到

相應異常模式的SPSR。然后CPSR會(huì )被設置為相應的異常模式, PC被設置到對應異常的入口處執行其處理函數。

(上面這些都是ARM核自動(dòng)操作的)

ARM的子程序轉移指令BL會(huì )在改變PC前將返回地址放到LR中,所以從子程序返回時(shí)可以把r14放到PC來(lái)操作。如MOV pc, lr。

所有上面的動(dòng)作都暗示了如果異常處理函數會(huì )調用子程序(使用 BL),那么各異常模式都必須保證異常處理函數執行的過(guò)程中不能出現

同樣的異常,因為子函數的返回地址會(huì )被異常的返回地址覆蓋掉。(在早期的ARM版本中,可以通過(guò)禁止異常處理函數調用子函數或者切

換處理模式到User模式來(lái)解決這個(gè)問(wèn)題。第一種方式過(guò)于嚴格,而第二種方式可以會(huì )由于User模式缺少相應的權限而不能執行某些動(dòng)

作)。

為此,ARM v4及之后的版本提供了system mode這樣一種處理器模式來(lái)解決這個(gè)問(wèn)題。System mode是一種privileged的模式,而且共用

User模式的所有寄存器。Privileged模式的程序可以運行在這個(gè)模式,而不用擔心處理器異常會(huì )擦除LR。



關(guān)鍵詞: ARMSystemMod

評論


技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>