CPU_Registers_x86#Control_Registers

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
User avatar
lambdart
Posts: 4
Joined: Tue Jun 27, 2023 6:30 pm

CPU_Registers_x86#Control_Registers

Post 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
Last edited by lambdart on Tue Apr 15, 2025 7:41 am, edited 1 time in total.
User avatar
iansjack
Member
Member
Posts: 4759
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: CPU_Registers_x86#Control_Registers

Post by iansjack »

So, edit the wiki page. That's what wikis are for.
User avatar
lambdart
Posts: 4
Joined: Tue Jun 27, 2023 6:30 pm

Re: CPU_Registers_x86#Control_Registers

Post by lambdart »

I don't have permission.
User avatar
iansjack
Member
Member
Posts: 4759
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: CPU_Registers_x86#Control_Registers

Post by iansjack »

User avatar
lambdart
Posts: 4
Joined: Tue Jun 27, 2023 6:30 pm

Re: CPU_Registers_x86#Control_Registers

Post by lambdart »

Thanks, will do.
Post Reply