Armv8的同步异常、External abort等区别简析

描述

1、同步异常和异步异常的概念

具备以下3个行为的称之为同步异常:

  • The exception is generated as a result of direct execution or attempted execution of an instruction.
  • The return address presented to the exception handler is guaranteed to indicate the instruction that caused the exception.
  • The exception is precise

其实就是说:

  • 异常是由执行或尝试执行指令产生的
  • 产生异常的那个位置是确定的,即每次执行到“那个指令处”就会产生
  • 异常是precise的

具备以下3个行为的称之为异步异常:

  • The exception is not generated as a result of direct execution or attempted execution of the instruction stream. The return address presented to the exception handler is not guaranteed to indicate the instruction that caused the exception.
  • The exception is imprecise.

其实就是说:

  • 异常不是由执行或尝试执行指令产生的
  • 产生异常的那个位置不是确定的,即不知道执行到哪里,就产生了异常
  • 异常是imprecise的

那么precise 和 imprecise 又是什么意思呢??

SVC

比较绕、比较难懂,咱们换一个说法:按照预期产生的异常称之precise,反之imprecise

2、系统中有哪些同步异常?

  • 尝试执行UNDEFINED指令产生的任何异常,包括:
    (1)、尝试在不适当的异常级别执行指令。
    (2)、当指令被禁用时尝试执行指令。
    (3)、尝试执行尚未分配的指令位模式。
  • 非法执行状态异常。这些是由尝试执行指令引起的 PSTATE.IL 为 1,(详细可参考D1-2486 页上的AArch64 状态的非法返回事件)
  • 使用未对齐的 SP 导致的异常。
  • 尝试使用未对齐的 PC 执行指令导致的异常。
  • 由异常生成指令SVC、HVC或SMC引起的异常。
  • 尝试执行系统寄存器定义为被捕获到更高的异常级别。(详细可参考可配置的指令使能和禁止,在D1-2510 页)
  • 由内存地址转换系统生成的指令中止与尝试相关联从产生故障的内存区域执行指令。
  • 内存地址转换系统生成的数据中止与尝试读取或写入产生故障的内存。
  • 由地址未对齐引起的数据中止。
  • 如果实施FEAT_MTE2,则由标记检查故障引起的数据中止。。
  • 所有调试异常:(1)、Breakpoint Instruction exceptions. (2)、Breakpoint exceptions. (3)、Watchpoint exceptions. (4)、Vector Catch exceptions. (5)、Software Step exceptions.
  • 在支持捕获浮点异常的实现中,由捕获的IEEE 浮点异常引起的异常
  • 在某些实现中,外部中止。外部中止是失败的内存访问,包括访问地址转换期间发生的内存系统的那些部分。

3、Serror的理解

Serror(也称System Error),是异步异常的一种,一般是来自 Externalaborts当memory system访问时bus上产生的 Externalaborts 。例如

  • 访问内存被TZC挡住时,bus会返回的一个异常

SVC

注意,像MMU产生的异常,它属于 internalabort,它是同步异常。像未定义指令异常,它也是同步异常

4、External abort的理解

External Abort,可以同步异常,也可以是Serror

SVC
例如:

  • Instruction Abort 可能是内部同步异常,也可能是同步External Abort
  • Data Abort 可能是内部同步异常,也可能是同步External Abort (即 External abort 可以属于同步异常哦)

SVC

4、instruction abort、data abort

在aarch64架构中,instruction abort、data abort已然变成了同步异常中的一种。不再是单独的异常模型了。所以当出现instruction abort、data abort时,那么一定是同步异常,可能是internal abort,也可能是external abort,但终归是同步异常。

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分