1

我正在尝试编写程序集来检测当前中断是否发生在两个特定指令之间。

我想我有它,但对我来说测试并不容易,所以如果有人可以验证,我将非常感激。

LDR R0, =INSTR_A ;address of first instruction
CMP LR, R0       ;are we ahead of the first?
BLO NOPE
LDR R0, =INSTR_B ;yes, address of second instr
CMP LR, R0       ;are we ahead of second?
{YEP}LO          ;no, so we're between, do {stuff}LO
{MORE STUFF}LO

这看起来对吗?

我担心的是我应该使用LS而不是LO

4

2 回答 2

1

LR_IRQ 始终是被中断指令的地址+4。

IE:

 0x00 mov r0, #0  <-- First instruction
 0x04 mov r1, #1
 0x08 mov r2, #2  <-- Interrupt occurs here, Address will be 0x0c in LR_irq not 0x08
 0x0c mov r3, #4  <-- Second instruction

我希望你现在能弄清楚你的代码有什么问题:)

于 2013-12-27T02:55:30.967 回答
-1
LDR R0, =INSTR_A ;address of first instruction
CMP LR, R0       ;If LR < R0 (or LR - R0 underflows), set carry
BLO NOPE         ; Branch if carry set (LO = CC)
LDR R0, =INSTR_B ;yes, address of second instr
CMP LR, R0       ;are we ahead of second?
BLO YEP          ;This is what you meant?
于 2013-12-24T10:54:03.910 回答