如何在GCC内联汇编中的Intel x86_64寄存器r8至r15上指定寄存器约束? [英] How to specify register constraints on the Intel x86_64 register r8 to r15 in GCC inline assembly?

查看:339
本文介绍了如何在GCC内联汇编中的Intel x86_64寄存器r8至r15上指定寄存器约束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是寄存器加载代码的列表:

Here's the list of register loading codes:

一个eax
b ebx
c ecx
d edx
塞西
D edi
I常数(0到31)
q,r动态分配的寄存器(请参见下文)
g eax,ebx,ecx,edx或内存中的变量
一个eax和edx合并为一个64位整数(使用long long)

a eax
b ebx
c ecx
d edx
S esi
D edi
I constant value (0 to 31)
q,r dynamically allocated register (see below)
g eax, ebx, ecx, edx or variable in memory
A eax and edx combined into a 64-bit integer (use long longs)

但这是Intel i386的寄存器限制.我的问题是在哪里可以找到英特尔x86_64系统的寄存器约束,例如:

But this is register constraints for intel i386. My question is where I can find the register constraints of intel x86_64 system, like:

? %r10
? %r8
? %rdx

? %r10
? %r8
? %rdx

以此类推.

推荐答案

机器特定的约束在 config/i386/constraints.md .

The machine specific constraints have a section in the gcc manual - the ugly details are found in config/i386/constraints.md.

对于x86-64,某些约束具有不同的含义,例如,在32位模式下,q%eax%ebx%ecx%edx;在64位模式下,它是任何通用整数寄存器-基本上与r约束相同.像a这样的特定寄存器名称现在指的是%raxd%rdx等.

Some constraints have different meanings for x86-64, e.g., q is %eax,%ebx,%ecx,%edx in 32-bit mode; in 64-bit mode, it's any general purpose integer register - and essentially the same as the r constraint. Specific registers names like a now refer to %rax, d to %rdx, etc.

但是,%r8 .. %r15没有特殊的约束或名称. 此处.

There are, however, no special constraints or names for %r8 .. %r15. There's an excellent (x86-64 specific) tutorial on inline assembly and constraint use here.

这篇关于如何在GCC内联汇编中的Intel x86_64寄存器r8至r15上指定寄存器约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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