armv8/armv9同步异常的介绍

Source

快速链接:
.
👉👉👉 个人博客笔记导读目录(全部) 👈👈👈

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 又是什么意思呢??
在这里插入图片描述
比较绕、比较难懂,咱们换一个说法:按照预期产生的异常称之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 浮点异常引起的异常
  • 在某些实现中,外部中止。外部中止是失败的内存访问,包括访问地址转换期间发生的内存系统的那些部分。