我想使用 arm 组件将 1 个 32 位十六进制直接加载到寄存器中。
mov r1,#0x6c617669
Run Code Online (Sandbox Code Playgroud)
这不能使用,因为从这条指令我们只能加载 8 位值。所以我直接从内存中加载了 32 位值。那么如何将 32 位值存储在内存中并使用 arm 组件将其直接加载到寄存器中呢?
我试过这个代码。
.global main
main:
sub sp,sp,#4
str lr,[sp,#0]
sub sp,sp,#4
str r0,x
add sp,sp,#4
ldr lr,[sp,#0]
add sp,sp,#4
mov pc,lr
.data
x: .word 0x6c617669
Run Code Online (Sandbox Code Playgroud)
但给出以下错误。
test1.s: Assembler messages:
test1.s:45: Error: internal_relocation (type: OFFSET_IMM) not fixed up
Run Code Online (Sandbox Code Playgroud)