有人可以解释在ARM分支运算code? [英] Can someone explain the branch opcode in ARM?

查看:261
本文介绍了有人可以解释在ARM分支运算code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创造一个运算code跳转到一个地址。

I'm trying to create an opcode to jump to an address.

我看了手册中,我看到:

I looked in the manual and I see:

B<c> <label>

31 30 29 28 | 27 26 25 24 | 23 ................. 0
    cond      1  0  1  0          imm24

我不明白是什么 COND imm24 是。我怎么会去创造一个运算code要跳转到某个地址,例如跳转到 0xbeffffbc

I don't understand what cond and imm24 are. How would I go about creating an opcode to branch to some address, for example branch to 0xbeffffbc?

推荐答案

B 相对的高达+/- 32MB分支。眼前的EN codeS有符号从当前PC的偏移目标地址(即该指令+ 8) - 注意,这个偏移量计算中的的,而不是字节;由于指令总是字对齐,任何偏移底部的两位将永远是00,并在编码因而作出暗示。

B is a relative branch of up to +/-32MB. The immediate encodes the signed offset of the target address from the current PC (i.e. this instruction + 8) - note that this offset is counted in words, not bytes; since instructions are always word-aligned, the bottom two bits of any offset will always be 00 and are thus made implicit in the encoding.

COND 是一样的predicate领域的其他大多数ARM指令。如果你要围绕指令编码戳点你应该意识到这一点已经 - 在ARM公司的(在V7A / R版我有方便A8.3部分)中的条件执行一节中有完整的详细信息。

cond is the same predicate field as in most other ARM instructions. If you've got to the point of poking around instruction encodings you probably should be aware of that already - the "Conditional Execution" section of the ARM ARM (section A8.3 in the v7A/R edition I have handy) has the complete details.

与ARM公司的典型烦恼的是,虽然编码字段和价值观,他们重新present的的在指令说明所述,你有时不得不交叉引用伪code至弄清楚到底是怎么回事。

The typical annoyance with the ARM ARM is that whilst the encoding fields and the values they represent are described in the instruction descriptions, you do sometimes have to cross-reference the pseudocode to figure out exactly what's going on.

这篇关于有人可以解释在ARM分支运算code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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