gpt4 book ai didi

c - 与 '%rbx' 后缀一起使用的寄存器 0x​​104567910 不正确

转载 作者:行者123 更新时间:2023-11-30 16:14:28 25 4
gpt4 key购买 nike

我正在尝试使用 gcc 编译器在 Linux 下编译此代码:

static inline unsigned long get_current(void)
{
unsigned long current;

asm volatile (
" movl %%esp, %%eax;"
" andl %1, %%eax;"
" movl (%%eax), %0;"
: "=r" (current)
: "i" (0xfffff000)
);
return current;
}

但我收到此错误:

program.c: Assembler messages: program.c:455: Error: incorrect
register `%rbx' used with `l' suffix

这里出了什么问题?

最佳答案

显然,您正在针对 64 位进行编译。如果不是您想要的,请尝试使用 gcc -m32,或者使用 64 位寄存器(%esp 在 x64 上根本没有意义)。

关于c - 与 '%rbx' 后缀一起使用的寄存器 0x​​104567910 不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57647188/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com