gpt4 book ai didi

assembly - 38 "D"D 位中的 6's "代表什么?

转载 作者:行者123 更新时间:2023-12-02 02:43:44 24 4
gpt4 key购买 nike

the article on the GDT OSDev wiki 描述了用作 CS 描述符的 D 位的标志,如下所示:

Sz: Size bit. If 0 the selector defines 16 bit protected mode. If 1 it defines 32 bit protected mode. You can have both 16 bit and 32 bit selectors at once.

另一个问题引用了英特尔手册:What does the D flag in the code segment descriptor do for x86-64 instructions?它链接到 Intel 64 and IA-32 Architectures Software Developer’s Manual Volume 3 [...]: System Programming Guide 中的“3.4.5 段描述符”部分,阅读:

D/B (default operation size/default stack pointer size and/or upper bound) flag

Performs different functions depending on whether the segment descriptor is an executable code segment, an expand-down data segment, or a stack segment. (This flag should always be set to 1 for 32-bit code and data segments and to 0 for 16-bit code and data segments.)

• Executable code segment. The flag is called the D flag and it indicates the default length for effective addresses and operands referenced by instructions in the segment. If the flag is set, 32-bit addresses and 32-bit or 8-bit operands are assumed; if it is clear, 16-bit addresses and 16-bit or 8-bit operands are assumed. The instruction prefix 66H can be used to select an operand size other than the default, and the prefix 67H can be used select an address size other than the default.

问题是,“D”代表什么?

最佳答案

我找到了 Intel 80386 Programmer's Reference Manual, 1987 的副本16.1 How the 80386 Implements 16-Bit and 32-Bit Features中有以下描述:

The features of the architecture that permit the 80386 to work equally well with 32-bit and 16-bit address and operand sizes include:

  • The D-bit (default bit) of code-segment descriptors, which determines the default choice of operand-size and address-size for the instructions of a code segment. (In real-address mode and V86 mode, which do not use descriptors, the default is 16 bits.) A code segment whose D-bit is set is known as a USE32 segment; a code segment whose D-bit is zero is a USE16 segment. The D-bit eliminates the need to encode the operand size and address size in instructions when all instructions use operands and effective addresses of the same size.

  • Instruction prefixes that explicitly override the default choice of operand size and address size (available in protected mode as well as in real-address mode and V86 mode).

  • Separate 32-bit and 16-bit gates for intersegment control transfers (including call gates, interrupt gates, and trap gates). The operand size for the control transfer is determined by the type of gate, not by the D-bit or prefix of the transfer instruction.

  • Registers that can be used both for 32-bit and 16-bit operands and effective-address calculations.

  • The B-bit (big bit) of data-segment descriptors, which determines the size of stack pointer (32-bit ESP or 16-bit SP) used by the CPU for implicit stack references.

因此“D 位”代表“默认操作数和地址大小”(对于代码段),“B 位”代表“Big”(对于堆栈段) .

关于assembly - 38 "D"D 位中的 6's "代表什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63133724/

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