SVC 处理程序以哪种模式启动? [英] Which mode does the SVC handler start in?

查看:24
本文介绍了SVC 处理程序以哪种模式启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ARM SVC 处理程序以哪种模式启动? 基本上,我想知道当引发 SVC 异常时 ARM 内核处于哪种模式?

Which mode does the ARM SVC handler start in? Basically, I want to know which mode the ARM core is in when an SVC exception is raised?

似乎在 ARM ARM 中找不到它,但我猜它是从 Supervisor 开始的.

Can't seem to find it in the ARM ARM, but my guess would be that it starts in Supervisor.

推荐答案

您是在谈论 SWI 处理程序吗?是的,我看到有些地方将其称为 SWI 指令,但有时称为 SVC 指令.

Are you talking about the SWI handler? Yes, I see some places they refer to it as the SWI instruction but sometimes the SVC instruction.

注意:在旧版本的 ARM 架构中,SVC 被称为 SWI,即软件中断.

Note: In older versions of the ARM architecture, SVC was called SWI, Software Interrupt.

来自ARM ARM

Exception type           Mode       Address
----------------------------------------------
Reset                    Supervisor 0x00000000
Undefined Instruction    Undefined  0x00000004
Software Interrupt (SWI) Supervisor 0x00000008
Prefetch Abort           Abort      0x0000000C
Data Abort               Abort      0x00000010
IRQ                      IRQ        0x00000018
FIQ                      FIQ        0x0000001C

...

软件中断异常

软件中断指令 (SWI) 进入监督模式以请求特定的监督(操作系统)功能.执行 SWI 时,会执行以下操作:

The Software Interrupt instruction (SWI) enters Supervisor mode to request a particular supervisor (operating system) function. When a SWI is executed, the following actions are performed:

R14_svc = address of next instruction after the SWI instruction
SPSR_svc = CPSR
CPSR[4:0] = 0b10011  /* Enter Supervisor mode */
CPSR[5] = 0          /* Execute in ARM state */
                     /* CPSR[6] is unchanged */
CPSR[7]= 1           /* Disable normal interrupts */
                     /* CPSR[8] is unchanged */
CPSR[9] = CP15_reg1_EEbit /* Endianness on exception entry */
PC = 0x00000008

执行SWI操作后返回,使用如下指令恢复PC(来自R14_svc)和CPSR(来自SPSR_svc),返回SWI之后的指令:MOVS PC,R14

To return after performing the SWI operation, use the following instruction to restore the PC (from R14_svc) and CPSR (from SPSR_svc) and return to the instruction following the SWI: MOVS PC,R14

这篇关于SVC 处理程序以哪种模式启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆