📄 s15_02.htm
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><HTML><HEAD><TITLE>80386 Programmer's Reference Manual -- Section 15.2</TITLE></HEAD><BODY><B>up:</B> <A HREF="c15.htm">Chapter 15 -- Virtual 8086 Mode</A><BR><B>prev:</B> <A HREF="s15_01.htm">15.1 Executing 8086 Code</A><BR><B>next:</B> <A HREF="s15_03.htm">15.3 Entering and Leaving V86 Mode</A><P><HR><P><H1>15.2 Structure of a V86 Task</H1>A V86 task consists partly of the 8086 program to be executed and partly of80386 "native mode" code that serves as the virtual-machine monitor. Thetask must be represented by an 80386 TSS (not an 80286 TSS). The processorenters V86 mode to execute the 8086 program and returns to protected mode toexecute the monitor or other 80386 tasks.<P>To run successfully in V86 mode, an existing 8086 program needs thefollowing:<UL><LI> A V86 monitor.<LI> Operating-system services.</UL>The V86 monitor is 80386 protected-mode code that executes atprivilege-level zero. The monitor consists primarily of initialization andexception-handling procedures. As for any other 80386 program,executable-segment descriptors for the monitor must exist in the GDT or inthe task's LDT. The linear addresses above 10FFEFH are available for theV86 monitor, the operating system, and other systems software. The monitormay also need data-segment descriptors so that it can examine the interruptvector table or other parts of the 8086 program in the first megabyte of theaddress space.<P>In general, there are two options for implementing the 8086 operatingsystem:<OL><LI> The 8086 operating system may run as part of the 8086 code. Thisapproach is desirable for any of the following reasons:<UL><LI> The 8086 applications code modifies the operating system.<LI> There is not sufficient development time to reimplement the 8086operating system as 80386 code.</UL><LI> The 8086 operating system may be implemented or emulated in the V86monitor. This approach is desirable for any of the following reasons:<UL><LI> Operating system functions can be more easily coordinated amongseveral V86 tasks.<LI> The functions of the 8086 operating system can be easily emulatedby calls to the 80386 operating system.</UL></OL>Note that, regardless of the approach chosen for implementing the 8086operating system, different V86 tasks may use different 8086 operatingsystems.<H2>15.2.1 Using Paging for V86 Tasks</H2>Paging is not necessary for a single V86 task, but paging is useful ornecessary for any of the following reasons:<UL><LI> To create multiple V86 tasks. Each task must map the lower megabyte oflinear addresses to different physical locations.<LI> To emulate the megabyte wrap. On members of the 8086 family, it ispossible to specify addresses larger than one megabyte. For example,with a selector value of 0FFFFH and an offset of 0FFFFH, the effectiveaddress would be 10FFEFH (one megabyte + 65519). The 8086, which canform addresses only up to 20 bits long, truncates the high-order bit,thereby "wrapping" this address to 0FFEFH. The 80386, however, whichcan form addresses up to 32 bits long does not truncate such anaddress. If any 8086 programs depend on this addressing anomaly, thesame effect can be achieved in a V86 task by mapping linear addressesbetween 100000H and 110000H and linear addresses between 0 and 10000Hto the same physical addresses.<LI> To create a virtual address space larger than the physical addressspace.<LI> To share 8086 OS code or ROM code that is common to several 8086programs that are executing simultaneously.<LI> To redirect or trap references to memory-mapped I/O devices.</UL><H2>15.2.2 Protection within a V86 Task</H2>Because it does not refer to descriptors while executing 8086 programs, theprocessor also does not utilize the protection mechanisms offered bydescriptors. To protect the systems software that runs in a V86 task fromthe 8086 program, software designers may follow either of these approaches:<UL><LI> Reserve the first megabyte (plus 64 kilobytes) of each task's linearaddress space for the 8086 program. An 8086 task cannot generateaddresses outside this range.<LI> Use the U/S bit of page-table entries to protect the virtual-machinemonitor and other systems software in each virtual 8086 task's space.When the processor is in V86 mode, CPL is 3. Therefore, an 8086 programhas only user privileges. If the pages of the virtual-machine monitorhave supervisor privilege, they cannot be accessed by the 8086 program.</UL><P><HR><P><B>up:</B> <A HREF="c15.htm">Chapter 15 -- Virtual 8086 Mode</A><BR><B>prev:</B> <A HREF="s15_01.htm">15.1 Executing 8086 Code</A><BR><B>next:</B> <A HREF="s15_03.htm">15.3 Entering and Leaving V86 Mode</A></BODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -