ARM BLX指令范围(绝对值) [英] ARM BLX Instruction Range (absolute)

查看:500
本文介绍了ARM BLX指令范围(绝对值)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于ARM BLX指令的问题,特别是关于BLX RX指令的问题.在ARM手册上指出,对于BLX标签,标签应在32MB范围内.在我的代码中,我将R0寄存器设置为指向address1.我当前地址和地址1(目标地址)之间的距离约为0x05000000.

I got a question about the ARM BLX instruction, specifically regarding BLX RX instruction. On the ARM manual it states that for BLX label, label should be within the 32MB range. In my code, I set the R0 register to point to address1. The distance between my current address and address1 (the destination address) is about 0x05000000.

当我到达指令时,它崩溃了(地址1中的代码是ARM,因此T模式没有问题).将绝对值与BLX一起使用时是否有限制?我应该使用单板吗?

When I reach the instruction, it crashes (the code in address1 is ARM so no problems with T-mode). Is there any limit when using absolute values with BLX? Should I use veneers?

谢谢!

推荐答案

您可以将任何地址用作BLX RX形式的RX寄存器.它将执行手臂中描述的动作.

You can use any address as the RX register in the form BLX RX. It will perform the actions described in the arm arm.


if ConditionPassed(cond) then
    target = Rm
    LR = address of instruction after the BLX instruction
    CPSR T bit = target[0]
    PC = target AND 0xFFFFFFFE

如果代码,调用或被调用的代码都不是拇指模式,那么您可能还可以,请确保在这种情况下,您给它的地址的lsbit为零.您实际上需要在0x05000000处有代码,并且需要有用于处理分支链接的代码,这意味着如果发出更多的bl样式调用,它将维护链接寄存器(r14).同样,如果要在从其他人调用的函数中进行此blx调用,则需要在进行blx调用之前保留r14并还原r14,或者在从函数返回时做任何将该值返回r15(pc)的操作.

If none of the code, calling or code being called is thumb mode then you are probably fine, make sure in that case the lsbit of the address you give it is a zero. You need to actually have code at 0x05000000 and needs to be code intented to handle a branch-link, meaning it maintains the link register (r14) if it makes more bl style calls. Likewise if you are making this blx call inside a function that was called from someone else you need to preserve r14 before making the blx call and restore r14 and or do whatever to put that value back in r15 (pc) when returning from your function.

反汇编/objdump清单的代码示例或摘要对于进一步帮助您解决此问题很有用.包含blx的代码和被调用的代码.

A code example or snippets of the disassembly/objdump listing would be useful to further help you solve this problem. the code containing the blx and the code being called.

这篇关于ARM BLX指令范围(绝对值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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