问题标签 [thumb]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
585 浏览

assembly - 需要一些示例拇指 2 说明

我对 Thumb 2 指令集感到困惑。

我知道 ARM 指令的大小为 32 位,拇指大小为 16 位,拇指 2 大小为 32/16 位。

我可以从此链接中找到示例 ARM 指令,并从此链接中找到拇指指令。

但我找不到任何 Thumb 2 说明。任何人都可以显示一些拇指 2 说明吗?

我想我还没有 Thumb 2 指令的概念(这可能是我找不到任何 Thmub 2 指令的原因)。任何人都可以更好地澄清吗?

0 投票
1 回答
504 浏览

assembly - GNU 汇编器,ARM IT 块错误

我收到一条错误消息,说 addeq 应该在 IT 块中。据我所知。

这是代码的一部分,位于https://github.com/Jcfunk/g3_kernel/blob/lp-release/arch/arm/crypto/aesbs-core.S_shipped的第 455 行

addeq 在 IT 块中吗?

从我用谷歌搜索的内容来看,If-Then 块,这个 IT 块意味着 if EQ then ADDEQ else BNE .Ldec_loop。我觉得 ADDEQ 在 IT 模块中,但我对手臂组装一无所知。或者可能是构建标志冲突。

这是 make 输出, make V=1 zImage-dtb ,可能问题是传递给 AS 的标志之一

我正在使用 GNU 汇编器版本 2.25.1 (arm-linux-gnueabihf) 使用 BFD 版本 (GNU Binutils for Ubuntu) 2.25.1 gcc (Ubuntu 5.2.1-17ubuntu4) 5.2.1 20150911

这是 LG G3 的 Android 内核的一部分,构建在未交叉编译的 arm 设备上

构建标志 -nostdinc -isystem /usr/lib/gcc/arm-linux-gnueabihf/5/include -I/sdcard/build/navelA/arch/arm/include -Iarch/arm/include/generated -Iinclude -include ./包括/linux/kconfig。h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-msm/include -Wall -DNDEBUG -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration - Wno-format-security -fno-delete-null-pointer-checks -mcpu=cortex-a15 -mtune=cortex-a15 -mfpu=neon-vfpv4 -marm -ffast-math -fsingle-precision-constant -fgcse-lm - fgcse-sm -fsched-spec-load -fforce-addr -Os -marm -fno-dwarf2-cfi-asm -fstack-protector -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 - mcpu=cortex-a15 -msoft-float -Uarm -Wframe-larger-than=1024 -Wno-unused-but-set-variable -fomit-frame-pointer -gdwarf-2 -Wdeclaration-after-statement -Wno-pointer-签名 -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -munaligned-access -fforce-addr -fsingle-precision-constant -mcpu=cortex-a15 -mtune=cortex-a15 -marm-mfpu=neon-vfpv4 -fgcse-las -fpredictive-commoning

0 投票
4 回答
1140 浏览

c - 更改函数指针的地址值

我在 C 中有以下代码:

functionPtr是一个函数指针,它指向函数addInt的特定地址。我想更改其值的 1 位,但我无法弄清楚如何。

假设functionPtr在最后一条语句之后指向0xABC0(假设是 16 位地址)。我想将其值更改为0xABC1。我试图用 0x1 对值进行 OR 运算,但我猜操作数转换有问题:

我知道搞乱指针是有风险的,但我必须更改地址的 LSB 才能进入 ARM Cortex-M4 MCU 的 Thumb 状态。

0 投票
2 回答
844 浏览

arm - 混合 ARM/Thumb2 ELF 文件的反汇编

我正在尝试反汇编我使用arm-linux-gnueabihf目标编译的 ELF 可执行文件thumb-2。但是,ARM 指令编码让我在调试反汇编程序时感到困惑。让我们考虑以下指令:

mov.w fp, #0

我使用objdumphopper作为 thumb-2 指令对其进行了反汇编。该指令出现在内存中,4ff0000b这意味着它实际上是0b00f04f(小端)。因此,指令的二进制编码为:

0000 1011 0000 0000 1111 0000 0100 1111

根据 ARM 架构手册,似乎所有 thumb-2 指令都应该以111[10|01|11]. 因此,上述编码不对应于任何 thumb-2 指令。此外,它与 A8.8.102 节(第 484 页)中的任何编码都不匹配。

我错过了什么吗?

0 投票
0 回答
63 浏览

arm - ELF二进制:为什么符号值与实际符号地址不同?

这是情况。我正在调查 ARM 二进制文件。使用objdump -T查看动态符号表时,输出显示我(摘自真实案例):

符号的反汇编给出以下(objdump -d):

我的问题是,您可以看到动态符号表中指定的值SomeFunction是 0x2055,但实际反汇编从 0x2054 开始。但是,对于_Unwind_GetTextRelBase,程序集从符号表中指定的地址开始。这背后的逻辑是什么,我如何以编程方式识别正确的起始地址?

0 投票
1 回答
2059 浏览

assembly - 在 ARM 汇编程序中使用 .W 后缀

我正在阅读指令集手册,并且想知道.W后缀。

手册说:

在某些情况下,可能需要指定 .W 后缀,例如,如果操作数是指令的标签或文字数据,例如分支指令。这是因为汇编器可能不会自动生成正确大小的编码。

我想不出有什么理由需要覆盖汇编程序的默认编码。到目前为止,我尝试过的东西在没有.W.

他们是否真的添加了一种特殊的语法来克服汇编器中可能存在的错误(也许同时修复了)?

您能否提供一些我必须明确使用 .W(Cortex-M3 上的 Thumb2)的示例。

0 投票
1 回答
604 浏览

linux - Linux下的Thumb汇编

我正在尝试.o在 Ubuntu 上使用arm-linux-gnueabi-as. 这是我的一组说明:

当我运行时:arm-linux-gnueabi-as -mthumb thumb.s -o thumb.o 我收到此错误: thumb.s:7: Error: selected processor does not support Thumb mode `vst1.32 {D16-D17},[R2]'

我试过使用参数-mcpu=<cpu name>-march=<arch name>like -mcpu=cortex-m4-march=armv7-m但我仍然遇到同样的错误。

有没有办法模拟另一个 CPU 来获取拇指指令集?

0 投票
2 回答
3728 浏览

assembly - How to generate the machine code of Thumb instructions?

I searched Google for generating machine code of ARM instructions, such as this one Converting very simple ARM instructions to binary/hex

The answer referenced ARM7TDMI-S Data Sheet (ARM DDI 0084D). The diagram of data processing instructions is good enough. Unfortunately, it's for ARM instructions, not for Thumb/Thumb-2 instructions.

Take the B instruction as an example. ARM Architecture Reference Manual - ARMv7-A and ARMv7-R edition section A8.8.18, Encoding T4:

B instruction, encoding T4

For the assembly code:

How can I encode the immediate value 0x50 into the 4-byte machine code? Or if I want to write a C function that takes the B instruction and the as inputs, and return the encoded machine code. How can I implement such a function?

I know the immediate values encoding on ARM. Here http://alisdair.mcdiarmid.org/arm-immediate-value-encoding/ is a good tutorial.

I just want to know where is the imm10 and imm11 from, and how to construct the full machine code with them.

0 投票
2 回答
4672 浏览

assembly - 如何在 Thumb 中移动负数

我试图在拇指中移动一个负值。

在 ARM 中很容易,

mvn r0, #1

如何将负值移动到 Thumb 中的寄存器?

谢谢。

0 投票
1 回答
3325 浏览

assembly - 如何将拇指条件指令放入 IT 块

我正在将一些继承的代码移植到我当前的平台上。当我编译它时,它报告了一些关于 arm 汇编代码的错误。

消息显示:

我是武装汇编程序的新手,所以我的问题是如何将下面的代码变成IT块。正如编译器所要求的那样。

谢谢