汇编代码似乎没有返回存储在rbx中的内存地址

时间:2019-10-11 21:36:20

标签: assembly x86-64 nasm

我编写了这个简单的汇编代码(在Linux上为nasm),并期望让rbx存储用于保存浮点数乘法的内存空间的地址:

section .data
real1:  dq 25.665544
real2:  dq 10.000

section .text
global _start
_start:
fld qword [real1]       ; load real1 in the float stack, st0
fld qword [real2]       ; st0 now holds real2, real1 in st1
fmul st0, st1           ; st0 *= st1
fstp qword [real1]      ; save st0 in real1 and pop, real1 has the result
fstp qword [real2]      ; save st1 in real2 and pop, float stack is empty
mov rbx, qword real1    ; store the address of real1 in rbx

mov rax, 1
int 80h

编译程序并运行后,我执行“ echo $?”查看其返回值。嗯,它在我的终端上显示224,但是我希望看到类似内存地址的内容,我相信它最后会保存在rbx中。也许我的期望是错误的。 你能澄清发生了什么吗?

1 个答案:

答案 0 :(得分:1)

Linux退出代码只有8位长,因​​此您返回的数字将从64位截断为8。