各位专家:
目前正在学习ARMv8 Arch Ref Manual.
D1.10.2 Exception vectors有点疑惑:
1. Table D1-6 定义了一个Vector Table应该具有的items
我们假定一个ARMv8 SOC实现了4个EL:EL0 / EL1 / EL2 / EL3
根据ARMv8 ARM手册:每一个EL,都有自己对应的Vector Table.
那么:
EL0 / EL1 / EL2 / EL3 :它们各自的Vector Table,应该是什么样的?
比如:
(1) EL0的Vector Table:应该有2个Block :
Current Exception level with SP_EL0
Current Exception level with SP_ELx, x>0
(2) EL1的Vector Table:应该有4个Block :
EL0 that is using AARCH64
EL0 that is using AARCH32
我的理解对吗?
EL0 does not have a vector table. Only EL1, EL2 and EL3 have vector tables. The location is set by VBAR_EL1, VBAR_EL2 and VBAR_EL3 respectively.
Each vector table has the same format, i.e. 16 entries (1 entry = 128 bytes) grouped into 4 blocks.
Starting from the lowest offset, each block is used for exceptions taken from:
- Current Exception level with SP_EL0
- Current Exception level with SP_ELx, x>0.
- Lower Exception level, where the implemented level immediately lower than the target level is using AArch64
- Lower Exception level, where the implemented level immediately lower than the target level is using AArch32
Consider an IRQ from an AArch32 application (EL0) running on an AArch64 OS (EL1), being handled by an AArch64 hypervisor (EL2).
In this case, the exception will be "from AArch32", but the hypervisor must save all the AArch64 states, as they may contain active values for the OS.
Therefore, the exception entry for this case would be:
VBAR_EL2 + 0x480
hi, yongfeng:
感谢回复!
我还有几个疑问:
1. 前2个block: Current EL with SP_EL0 / SP_ELx
能举个例子吗?
2. 基于你回复的帖子中所举例子:
(1) EL2是hypervisor,运行在AARCH64。
VBAR_EL2的Vector table,它的4个block是:
Current EL with SP_EL0
Current EL with SP_ELx
第3个block是EL1 Aarch64吗?
第4个block应该是EL1 Aarch32吗?
(2) EL0中发生的IRQ,可以通过register来控制它的target_EL=EL2,即:它想让HyperVisor来处理?
> 1. 前2个block: Current EL with SP_EL0 / SP_ELx> 能举个例子吗?
"with SP_EL0" means using the application's SP."with SP_ELx" means using the current EL's SP.
As far as I know, the purpose of differentiating SP_EL0 and SP_ELx is that the OS can prevent its own stack from overflow (which is critical for the system) by using the application's stack pointer (which is not as critical).
> 2. 基于你回复的帖子中所举例子:> (1) EL2是hypervisor,运行在AARCH64。> VBAR_EL2的Vector table,它的4个block是:> Current EL with SP_EL0 > Current EL with SP_ELx> 第3个block是EL1 Aarch64吗?
Yes.
> 第4个block应该是EL1 Aarch32吗?
Yes. > (2) EL0中发生的IRQ,可以通过register来控制它的target_EL=EL2,即:它想让HyperVisor来处理?
Yes. See HCR_EL2:AMOIMOFMO
hi, feng:
Thanks a lot
Hi Yongfeng and Xingguang,
你们好,多谢你们的回复。
hi, Yongfeng and Xingguang:
关于Exception Table,还有2个疑问:
1. Exception Table中的第3 block / 第4 block,应该只有一项存在吧
EL1 AArch64存在,那么"EL1 AArch32"就不需要建.
因为对于给定平台:EL1的执行态,应该是确定的吧.
2. 根据ARMv8 ARM手册C2.1.4节:
HVC : Target_EL = EL2
SMC :Target_EL = EL3
SVC : Target_EL = EL1
我的问题是:
这3个exception,它们的Target_EL,可以通过Software改为其它吗?
best wishes
> 1. Exception Table中的第3 block / 第4 block,应该只有一项存在吧> 比如:> EL1 AArch64存在,那么"EL1 AArch32"就不需要建.
In general, both blocks are needed.
> 因为对于给定平台:EL1的执行态,应该是确定的吧.
No.An AArch64 hypervisor may host a mixture of AArch64 and AArch32 OSes; an AArch64 OS may run a mixture of AArch32 and AArch64 applications. In those case, you need both blocks.
> 2. 根据ARMv8 ARM手册C2.1.4节:> HVC : Target_EL = EL2> SMC :Target_EL = EL3> SVC : Target_EL = EL1> 我的问题是:> 这3个exception,它们的Target_EL,可以通过Software改为其它吗?
No. Those instructions have specific functions:HVC: hypervisor callSMC: secure monitor callSVC: supervisor call (requesting OS functions)
So their target EL is fixed.