x86 LMSW from Virtual 8086 mode is allowed?

Emulation of old PCs, PC hardware, or PC peripherals.

x86 LMSW from Virtual 8086 mode is allowed?

Postby superfury » 2019-2-23 @ 12:39

Looking at the 80386 instruction set again, CR0 can't be modified from Virtual 8086 mode(throwing #GP(0)):
https://pdos.csail.mit.edu/6.828/2005/r ... /MOVRS.htm

But looking at LMSW reveals something odd:
https://pdos.csail.mit.edu/6.828/2005/r ... 6/LMSW.htm

The Virtual 8086 column clearly states that it's the same exceptions as in real mode.
So, in other words, you can modify bits 1-15 of CR0 from Virtual 8086 mode? So that exposes all FPU related functionality from CR0?

The only good thing about that is that you cannot clear the PE bit(bit 0) in CR0.
But you CAN modify bits 1-4, which may or may not be essential, according to that documentation from Intel.

Oddly enough, https://www.felixcloutier.com/x86/lmsw does state it throws #GP(0) in said mode?

So does it or does it not throw #GP(0) in V86 mode?
superfury
l33t
 
Posts: 3230
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: x86 LMSW from Virtual 8086 mode is allowed?

Postby crazyc » 2019-2-23 @ 13:27

The 386 manual is garbage. The IA32 manual clearly says "In protected or virtual-8086 mode, it can only be executed at CPL 0."
crazyc
Member
 
Posts: 143
Joined: 2013-2-02 @ 16:17


Return to PC Emulation

Who is online

Users browsing this forum: No registered users and 5 guests