How are protected / real modes connected with 32/16-bit processor modes? Real mode = 16 bits, protected - 32 bits? Or not?

  • 16 bit and 32 bit mode no. There is a real and protected. In real mode, the addresses are 16-bit, in the protected mode - 32-bit. - tilin
  • @tilin I read that, besides addressing, the dimension of the registers changes, is it ?. By the way, when is the addressing using 64 bit addresses? - wcobalt
  • Yes, the dimension of the registers is the same. There is also the so-called long mode, in which the registers and addresses are 64 bit. But it's all over simplified. Registers, for example, are divided into groups of different purposes (there are 128 bit or more), and the memory management mechanisms describe in a few words complex. - tilin
  • @tilin In protected mode, the addressing depends on the instructions in the code segment descriptor. 16 bit code can also be used. - Mike

1 answer 1

It depends on what is meant by 16/32 bit modes of operation. In principle, such modes of operation do not exist. There are such concepts as the used size of addresses and the used size of operands in instructions. And there is a default size and effective size. The prefixes of instructions 66h and 67h can switch the size of an operand or address used by this instruction. Their appearance in the instruction switches the size to "opposite" relative to the "current size". In turn, the current size depends on the mode of the processor and some other factors.

In real processor mode, the default is 16 bit arguments and 16 bit offsets. However, the use of prefixes allows you to override for the current instruction as the size of the operands as well as the size of the applied offset. (Addressing line A20 must be open for addressing beyond 1 Mb)

In the processor's protected mode, the default size of addresses and operands is specified by bit 54 of the code segment descriptor, called the DB bit (in other sources D ). If this bit is 0, then 16 bit sizes are used, if 1 then 32 bit sizes. In this case, the addressing mode in the stack segment is specified separately by the DB bit in the stack segment descriptor. When DB = 0 SP is used, when DB = 1 ESP.

In the long mode mode of 64-bit processors, bit 55 ( L ) starts to be used in descriptors to indicate 64-bit code, the DP flag is not used and must be 0 (the value 1 is reserved for possible future use)

In SMM (system management mode), the default is real-mode addressing, which can also be changed using instruction prefixes.