【问题标题】:Which mode does the SVC handler start in?SVC 处理程序以哪种模式启动?
【发布时间】:2012-01-28 09:38:26
【问题描述】:

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

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

【问题讨论】:

    标签: arm


    【解决方案1】:

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

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

    来自 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 时,会执行以下操作:

    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

    【讨论】:

      猜你喜欢
      • 2014-02-04
      • 1970-01-01
      • 1970-01-01
      • 2013-02-15
      • 1970-01-01
      • 2014-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多