Entering or Reentering VM86 Mode

Task Creation, Startup and Suspension

Create a TSS

Before the multitasking OS initially starts a DOS task, it creates a 32-bit TSS for the task, setting the EFlags[VM] bit to one in the TSS's EFlags field. It also creates a TSS descriptor (in the GDT) that points to the task's TSS in memory.

Each Task Gets a Timeslice

A multitasking OS usually permits a task to execute for a predefined period of time, typically referred to as a timeslice. This is accomplished by triggering a hardware timer prior to starting (or resuming) the task. The task is then started by the OS scheduler and continues to execute until a hardware interrupt is generated by the timeslice timer (unless the task is interrupted prior to this for some other reason). The timer interrupt selects an IDT entry containing a Task Gate that points to the OS's task scheduler. The task that was executing is suspended and the new task (i.e., the OS task scheduler) is resumed.

Unlike many other processors (e.g., the PowerPC processor family), the 386 processor did not incorporate a hardware “timeslice” timer to facilitate the timeslice approach to multitasking. Instead, the system designer had to incorporate a hardware timer external to the processor. This timer was implemented as an IO device that could be programmed for the desired interval and then enabled. The timer generates a maskable interrupt to the processor when it expires. Since the advent of the P54C version of the Pentium® processor, however, each IA32 processor implements the Local APIC which includes a programmable timer capable of generating an interrupt on expiration or at set intervals.

Select DOS Task via a Far Call or a Far Jump

The task is started by executing a far jump or a far CALL instruction with a CS value that selects the TSS descriptor (associated with the task) in the GDT. The offset portion of the target address is discarded.

When the processor determines that a TSS descriptor has been selected, it suspends the current task (in this case, the OS task scheduler) by copying the majority of the processor's registers into the OS scheduler's TSS. It then switches to the DOS task by loading the processor's register set from the DOS task's TSS. When the EFlags register is loaded from the TSS, EFlags[VM] is set to one, automatically placing the processor into VM86 mode. In other words, the watchdog logic is activated just before the task starts (or resumes) execution.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.136.90