ARM汇编函数的地址有一个字节偏移? [英] Function address in ARM assembly have one byte offset?

查看:637
本文介绍了ARM汇编函数的地址有一个字节偏移?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有以下组装code通过了 objdump的 F的地址() 080001d4 。但的printf(%X,F)输出 080001d5 。和 F()可以通过来完成(*((INT(*)())080001d5))()(*((INT(*)())080001d4))()

For example, I have the following assembly code got by objdump. The address of f() is 080001d4. But printf("%x", f) outputs 080001d5. And f() can be done by (*((int (*)())080001d5))() but (*((int (*)())080001d4))().

为什么有一个字节的函数地址偏移?

Why there is one byte offset in function address?

080001d4 <f>:
 80001d4:   2000        movs    r0, #0
 80001d6:   4770        bx  lr


推荐答案

ARM有两个指令模式和地址的最低显著位用于指示哪个模式的给定函数使用。为ARM模式Thumb模式奇地址,甚至地址。

ARM has two instruction modes, and the least-significant bit of the address is used to indicate which mode a given function uses. Odd addresses for Thumb mode, and even addresses for ARM mode.

地址将是,即使你重新编译使用 -marm 开关吧。

The address will be even if you recompile it using the -marm switch.

这篇关于ARM汇编函数的地址有一个字节偏移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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