什么是"= qm"?在扩展汇编程序中 [英] What is "=qm" in extended assembler

查看:130
本文介绍了什么是"= qm"?在扩展汇编程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看Intel提供的RDRAND指令的参考实现.该页面为英特尔数字随机数生成器(DRNG)软件实施指南,其代码来自

I was looking through an Intel provided reference implementation of RDRAND instruction. The page is Intel Digital Random Number Generator (DRNG) Software Implementation Guide, and the code came from Intel Digital Random Number Generator software code examples.

以下是英特尔的相关部分.它读取一个随机值并将其放在val中,并在成功时设置进位标志.

The following is the relevant portion from Intel. It reads a random value and places it in val, and it sets the carry flag on success.

char rc;
unsigned int val;

__asm__ volatile(
    "rdrand %0 ; setc %1"
    : "=r" (val), "=qm" (rc)
);

// 1 = success, 0 = underflow
if(rc) {
    // use val
    ...
}

必须问的问题.我认为 GNU扩展汇编程序并没有进行搜索,因为"= qm"产生了虚假点击.

Soory to have to ask. I don't think it was covered in GNU Extended Assembler, and searching for "=qm" is producing spurious hits.

"=qm"在扩展汇编程序中是什么意思?

What does the "=qm" mean in the extended assembler?

推荐答案

您正在查看的是 6.47.3.1简单约束 x86系列下特定机器的约束 部分.这个(=qm)组合了三个标志,指示:

What you're looking at is an inline assembler constraint. The GCC documentation is at 6.47.3.1 Simple Constraints and 6.47.3.4 Constraints for Particular Machines under x86 family section. This one (=qm) combines three flags which indicate:

  • =:操作数是只写的-它的先前值不相关.
  • q:操作数必须位于寄存器abcd中(例如,不能位于esi中).
  • m:操作数可以放在内存中.
  • =: The operand is write-only - its previous value is not relevant.
  • q: The operand must be in register a, b, c, or d (it cannot be in esi, for instance).
  • m: The operand may be placed in memory.

这篇关于什么是"= qm"?在扩展汇编程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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