arm架构的linux内核中,clrex指令的作用是什么 | 您所在的位置:网站首页 › clr是什么指令 › arm架构的linux内核中,clrex指令的作用是什么 |
1. clrex指令的作用:
《arm architecture reference manual》B2-1292以下简称arm arm手册
The ClearExclusiveLocal() procedure takes as arguments the processor identifier processorid . The procedure clears the local record of processor processorid for which an address has had a request for an exclusive access. It is IMPLEMENTATION DEFINED whether this operation also clears the global record of processor processorid that an address 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) 该函数是一个驱动模块,可以动态加载。 如上所示:基本所有的异常都要用到该指令,系统调用的返回也能用到。 虽然异常和系统调用的代码在内核中不多,但是当内核运行起来时,异常和系统调用的执行频率特别高! 所以该指令还是非常有用的。 |
CopyRight 2018-2019 实验室设备网 版权所有 |