LMSW bit 0 enables protected mode. It is known that on 386 and higher processors, the machine status word is just the low 16 bits of the 386 CR0 register. On the 286, you were allowed to set the bit to enter protected mode, but you were not allowed to leave protected mode without a reset (clear the bit).
The purpose of the program is to show, on the CPU it is run, whether LMSW is allowed to set the bit, and whether it is allowed to clear the bit.
Obviously the program must return safely, so if LMSW cannot clear the register, it should write CR0 to clear it.
It is possible that by the 486 and Pentium era (1996), LMSW no longer enforced the set-only behavior and allowed clearing the bit.
The reason for this test: joncampbell123/dosbox-x#2549
LMSW bit 0 enables protected mode. It is known that on 386 and higher processors, the machine status word is just the low 16 bits of the 386 CR0 register. On the 286, you were allowed to set the bit to enter protected mode, but you were not allowed to leave protected mode without a reset (clear the bit).
The purpose of the program is to show, on the CPU it is run, whether LMSW is allowed to set the bit, and whether it is allowed to clear the bit.
Obviously the program must return safely, so if LMSW cannot clear the register, it should write CR0 to clear it.
It is possible that by the 486 and Pentium era (1996), LMSW no longer enforced the set-only behavior and allowed clearing the bit.
The reason for this test: joncampbell123/dosbox-x#2549