Page 1 of 1

CPU_Registers_x86#Control_Registers

Posted: Mon Apr 14, 2025 2:08 pm
by lambdart
The wiki page should specific that the LMSW instruction can indeed modify the cr0 register,
but only the 4 lower bits will be modified which contains the PE, MP, EM, and TS flags.

From Intel's Manual (Volume 2A):

LMSW — Load Machine Status Word

Description

Loads the source operand into the machine status word, bits 0 through 15 of
register CR0. The source operand can be a 16-bit general-purpose register or a
memory location. Only the low-order 4 bits of the source operand (which contains
the PE, MP, EM, and TS flags) are loaded into CR0. The PG, CD, NW, AM, WP, NE,
and ET flags of CR0 are not affected. The operand-size attribute has no effect
on this instruction.

If the PE flag of the source operand (bit 0) is set to 1, the instruction causes
the processor to switch to protected mode. While in protected mode, the LMSW
instruction cannot be used to clear the PE flag and force a switch back to
real-address mode.

...

Operation

CR0[0:3] := SRC[0:3];

Flags Affected

None

Re: CPU_Registers_x86#Control_Registers

Posted: Tue Apr 15, 2025 4:03 am
by iansjack
So, edit the wiki page. That's what wikis are for.

Re: CPU_Registers_x86#Control_Registers

Posted: Tue Apr 15, 2025 7:39 am
by lambdart
I don't have permission.

Re: CPU_Registers_x86#Control_Registers

Posted: Tue Apr 15, 2025 7:43 am
by iansjack

Re: CPU_Registers_x86#Control_Registers

Posted: Tue Apr 15, 2025 8:02 am
by lambdart
Thanks, will do.