gpt4 book ai didi

assembly - 英特尔 SDM 手册中的 "set according to the result"是什么意思?

转载 作者:行者123 更新时间:2023-12-03 23:05:21 26 4
gpt4 key购买 nike

这是我在英特尔 x86-64 的文档中看到的 neg 和许多其他指令(包括 sub ,因此将 neg x 的 FLAGS 理解为 0 - x 取决于此)。

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


我假设 sf = dest < 0 , zf = dest == 0 ,但无法弄清楚其他标志是如何设置的。
我看到这个 “根据结果设置”短语无处不在,并希望您能帮助理解“相应地”设置标志的确切含义。

最佳答案

所以所有的标志都是根据执行的操作设置的,这就是“根据结果设置”的意思。

#3.4.3.1 Status FlagsThe 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) 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.

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标志可以直接修改。其他的根据操作设置。
Source - Intel

关于assembly - 英特尔 SDM 手册中的 "set according to the result"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40478386/

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