久久ER99热精品一区二区-久久精品99国产精品日本-久久精品免费一区二区三区-久久综合九色综合欧美狠狠

新聞中心

EEPW首頁 > 嵌入式系統 > 設計應用 > arm架構的linux內核中,clrex指令的作用是什么

arm架構的linux內核中,clrex指令的作用是什么

作者: 時間:2016-11-10 來源:網絡 收藏
1. clrex指令的作用:

arm architecture reference manual》B2-1292以下簡稱arm arm手冊

本文引用地址:http://cqxgywz.com/article/201611/317220.htm

The ClearExclusiveLocal() procedure takes as arguments the processor identifier processorid . The procedure clearsthe local record of processor processorid for which an address has had a request for an exclusive access. It isIMPLEMENTATION DEFINED whether this operation also clears the global record of processor processorid that anaddress has had a request for an exclusive access
該指令的作用就是在獨占訪問結束時,清除cpu中本地處理器針對某塊內存區域的獨占訪問標志(核中的某個狀態寄存器),以防在未清除時的其他操作,對系統產生影響。對于是否同時清除全局的獨占訪問標志,需要在設計cpu時的架構師決定。

2. clrex指令的作用很獨特,在linux內核中用在什么地方呢?

用在如下地方:
(1)數據中止異常、指令預取中止異常的處理時調用

(調用linaro-aarch64/arch/arm/mm/abort-ev7.s v7_early_abort==》clrex)
(2)從svc模式下的irq異常、未定義指令異常、數據中止異常、指令預取中止異常,處理結束返回時調用

(調用宏:linaro-aarch64/arch/arm/kernel/entry-header.s svc_exit)
(3) 返回到用戶層的快速系統調用/慢速系統調用(ret_slow_syscall,ret_fast_syscall==》

調用宏:linaro-aarch64/arch/arm/kernel/entry-header.s restore_user_regs==》clrex)
(4) run_all_tests 函數調用(==》kprobe_arm_test_cases==》TEST_UNSUPPORTED("clrex") ==》clrex)

該函數是一個驅動模塊,可以動態加載。

如上所示:基本所有的異常都要用到該指令,系統調用的返回也能用到。

雖然異常和系統調用的代碼在內核中不多,但是當內核運行起來時,異常和系統調用的執行頻率特別高!

所以該指令還是非常有用的。



評論


技術專區

關閉