发信人: zelor(东村遗少张作乐)
整理人: wenbobo(2003-01-09 10:07:24), 站内信件
|
What is Virtual 8086, why is it causing problems for me?
什么是虚拟8086模式?它能给带来什么问题?
Virtual 8086 mode is a sub-mode of protected mode. In short, virtual
8086 mode is whereby the cpu (in protected mode) is running a
"Emulated" 16bit 'segmented' model (real mode) machine.
V8086 mode can cause all different kinds of problems for OS
programmers.
虚拟8086模式(以下简称V86模式)是保护模式中的一种子模式。简而言之,V86
模式就是CPU(在保护模式下)运行了一个“模拟”的16位“段”模式(实模式)
的虚拟机。对系统程序员来说,V86模式能引起所有不同种类的问题。
The most common problem with v86 mode is that, you can't "enter"
protected mode inside a v86 task.
V86模式最常见的问题是,在一个V86任务中你不能“进入”到保护模式里。
That meaning, if you are running Windows or have emm386 in memory, you
can't do a "raw" switch into protected mode (it causes an exception if
I remember correctly!:)
这意味着,如果你正在运行windows或者驻留了emm386在内存里,你不能不问青红
皂白的切换进保护模式(如果我印象准确的话,这将造成一个异常!:))。
There are a few other more "technical" problems people have when using
v86 mode, mostly because v86 has some instructions "emulated" by what's
known as a v86-monitor program, as the cpu is in protected mode, some
instructions are high up on the security/protection level and running
those directly would cause no-end of trouble for the OS.
当使用V86模式时,人们还有许多其他“技术性”问题。主要是因为V86有一些指
令是通过V86监控程序模拟的,作为进由于CPU处于保护模式状态,有些指令已经
处于安全保护级别之上,直接运行这些指令将对操作系统造成无尽的麻烦。
Such technicalities are beyond the scope of a simple FAQ
这些技术已经超出一个简单的FAQ的范围了。
How do I detect if my machine is in Virtual 8086 mode?
如何检测机器是否处在V86模式?
EFLAGS.VM is NEVER pushed onto the stack if the V86 task uses PUSHFD.
You should check if CR0.PE=1 and then assume it's V86 if that bit is
set.
如果一个V86任务使用了PUSHFD命令,EFLAGS寄存器(扩展标志寄存器)的VM标志
*永远不会*入栈。
你应该检查CR0寄存器的PE位是否为1,如果被置位,则意味着当前在V86模式中。
detect_v86:
smsw ax
and eax,1 ;CR0.PE bit
ret
---- 生活,就是理想加泡面。
——张作乐,送你一束玫瑰
|
|