什么是双百分号(%%)在GCC内联汇编吗? [英] What does a double-percent sign (%%) do in gcc inline assembly?

查看:953
本文介绍了什么是双百分号(%%)在GCC内联汇编吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到一个code,看起来像这样来了:

I came across a code that looks like this:

asm volatile (
    # [...]
    "movl $1200, %%ecx;"
    # [...]
);

我知道什么是 MOVL $ 1200,ECX%确实在86。但我对为什么有两个百分比符号混淆。

I know what movl $1200, %ecx does in x86. but I was confused by why there are two percent signs.

推荐答案

GCC内联汇编使用%0%1%2等指输入和输出操作数。这意味着你需要使用两个%%真正的寄存器。

GCC inline assembly uses %0, %1, %2, etc. to refer to input and output operands. That means you need to use two %% for real registers.

勾选此 HOWTO 伟大的信息。

这篇关于什么是双百分号(%%)在GCC内联汇编吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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