ARM Trust Zone - 从SVC切换到监控模式时出错

时间:2016-08-05 12:34:52

标签: linux arm trust-zone

我是ARM TrustZone的新手,我正在尝试学习它的工作原理(因此,这种方法的所有安全含义对我来说并不重要)。 我有一块带有iMX6 Cortex-A9处理器的Sabrelite主板,该主板在安全(Linux内核)中启动。 我编写了一个简单的内核模块,可以将处理器模式从SVC切换到监控模式,但结果是分段错误。

这种方法有什么问题?

以下是代码:

static int __init hello_trustzone_init(void)
{
  int res = 0;

  printk(KERN_INFO "TZ - init trust zone - before monitor call\n");

  res = monitor();

  printk(KERN_INFO "TZ - init trust zone - after monitor call - %X\n", res);

  return 0;
}

和程序集监视程序:

#define cpsr_mode_mon       (0x16)

.global monitor
ENTRY(monitor)
        push    {r4-r8, lr}
.arch_extension sec
        CPS     #cpsr_mode_mon  // Move to monitor mode
        MRS     R0, CPSR    // Copy CPSR into R0
        pop {r4-r8, pc}
ENDPROC(monitor)

insmod这个模块导致:

TZ - init trust zone - before monitor call
Bad mode in data abort handler detected
Internal error: Oops - bad mode: 0 [#1] PREEMPT SMP ARM

0 个答案:

没有答案