“根据结果设置"是什么意思?在英特尔的 SDM 手册中是什么意思? [英] What does "set according to the result" mean in Intel's SDM manuals?

查看:26
本文介绍了“根据结果设置"是什么意思?在英特尔的 SDM 手册中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在英特尔 x86-64 的文档中看到的 neg 和许多其他说明(包括 sub,所以将 neg x 的 FLAGS 理解为 0 - x 取决于这一点.

Here is what I see in the documentation of Intel x86-64 for neg and many other instructions (including sub, so understanding FLAGS for neg x as 0 - x depends on this).

OFSFZFAFPF 标志根据结果​​设置.

The OF, SF, ZF, AF, and PF flags are set according to the result.

我假设 sf = dest <0, zf = dest == 0,但无法弄清楚其他标志是如何设置的.

I'm assuming that sf = dest < 0, zf = dest == 0, but can't figure out how the other flags are set.

我到处都看到这个根据结果设置"短语,希望您能帮助理解相应地"设置标志的确切含义.

I see this "set according to the result" phrase everywhere and would appreciate your help in understanding what it means precisely for flags to be set "accordingly".

推荐答案

所以所有的标志都是根据执行的操作设置的,这就是短语根据结果设置"的含义.意味着.

So all the of the flags are set based off the operation performed, which is what the phrase "set according to the result" means.

#3.4.3.1 状态标志EFLAGS 寄存器的状态标志(位 0、2、4、6、7 和 11)指示算术指令的结果,例如 ADD、SUB、MUL 和 DIV 指令.状态标志函数是:

#3.4.3.1 Status Flags The status flags (bits 0, 2, 4, 6, 7, and 11) of the EFLAGS register indicate the results of arithmetic instructions, such as the ADD, SUB, MUL, and DIV instructions. The status flag functions are:

  • CF (bit 0) 进位标志 — 如果算术运算从结果的最高有效位产生进位或借位,则置位;否则清除.该标志表示无符号整数算法的溢出条件.它还用于多精度算术.
  • PF (bit 2) Parity flag — 如果结果的最低有效字节包含偶数 1 位,则设置;否则清除.
  • AF(第 4 位)辅助进位标志 — 如果算术运算从结果的第 3 位产生进位或借位,则置位;否则清除.此标志用于二进制编码的十进制 (BCD) 算法.
  • ZF(位 6)零标志 — 如果结果为零则设置;否则清除.
  • SF (bit 7) Sign flag — 设置为等于结果的最高有效位,它是有符号整数的符号位.(0 表示正值,1 表示负值.)
  • OF (bit 11) 溢出标志 — 设置整数结果是太大的正数还是太小的负数(不包括符号位)以适应目标操作数;否则清除.此标志表示有符号整数(二进制补码)算术的溢出条件.
  • CF (bit 0) Carry flag — Set if an arithmetic operation generates a carry or a borrow out of the most- significant bit of the result; cleared otherwise. This flag indicates an overflow condition for unsigned-integer arithmetic. It is also used in multiple-precision arithmetic.
  • PF (bit 2) Parity flag — Set if the least-significant byte of the result contains an even number of 1 bits; cleared otherwise.
  • AF (bit 4) Auxiliary Carry flag — Set if an arithmetic operation generates a carry or a borrow out of bit 3 of the result; cleared otherwise. This flag is used in binary-coded decimal (BCD) arithmetic.
  • ZF (bit 6) Zero flag — Set if the result is zero; cleared otherwise.
  • SF (bit 7) Sign flag — Set equal to the most-significant bit of the result, which is the sign bit of a signed integer. (0 indicates a positive value and 1 indicates a negative value.)
  • OF (bit 11) Overflow flag — Set if the integer result is too large a positive number or too small a negative number (excluding the sign-bit) to fit in the destination operand; cleared otherwise. This flag indicates an overflow condition for signed-integer (two’s complement) arithmetic.

在这些状态标志中,只有CF标志可以直接修改,使用STC、CLC和CMC指令.位指令(BT、BTS、BTR 和 BTC)也将指定的位复制到 CF 标志中.

Of these status flags, only the CF flag can be modified directly, using the STC, CLC, and CMC instructions. Also the bit instructions (BT, BTS, BTR, and BTC) copy a specified bit into the CF flag.

只能直接修改CF标志.其他根据操作设置.

Only the CF flag can be modified directly. The others are set based on the operations.

来源 - 英特尔

这篇关于“根据结果设置"是什么意思?在英特尔的 SDM 手册中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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