x86vmmposter

Download Report

Transcript x86vmmposter

VIRTUAL MACHINE MONITOR
/*
The x86 Virtual Machine Monitor (VMM) project fully emulates an 8086 processor, memory subsystems and
peripherals in software to provide a virtual environment for multiple operating systems on a single workstation.
The x86 architecture is intrinsically difficult to virtualize, so the decision was taken to completely emulate the host
hardware. While this decision has added significantly to the task, it also makes not only porting the VMM to another
platform easier, but allows much greater flexibility and extensibility.
By using emulated hardware it’s possible to have any number of operating systems running simultaneously or
independently, each believing they have exclusive access to the host machine, while a user can move between
system screens without affecting their operation.
The VMM provides an alternative to userland (such as VMWare’s Player) virtual machine software, making it
unnecessary to have a operating system on which to run the VMM, instead rendering such possible future options
as real-time operating system transfers to different workstations.
Does DAA if add is 1 or DAS if add is 0
*/
void daadas(char add)
{
if(flag_read(ADJUST_FLAG) == 1 || (*lower8(&AX)&0xF) > 0x9)
{
flag_set(ADJUST_FLAG, 1);
if (add) *lower8(&AX) += 0x6;
else *lower8(&AX) -= 0x6;
}
else flag_set(ADJUST_FLAG, 0);
if(flag_read(CARRY_FLAG) ==1 ||((*lower8(&AX)&0xF0)>>4) > 0x9)
{
flag_set(CARRY_FLAG, 1);
if (add) *lower8(&AX) += 0x60;
else *lower8(&AX) -= 0x60;
}
else flag_set(CARRY_FLAG, 0);
flag_set(ZERO_FLAG, !*lower8(&AX));
flag_set(SIGN_FLAG, *lower8(&AX) >> 7);
parity(*lower8(&AX));
}
Example code from the CPU module – in this
case, the Decimal Adjust function (addition and
subtraction) .
The VMM is entirely coded in C and assembly to take advantage of the
speed and flexibility these languages provide from those that are practical
on the low level at which the VMM operates.
Using an assembly bootstrap, the VMM precompiled binary is loaded into
memory and then guest operating systems can be run within the VMM.
Control over the operating systems is provided by a text interface
accessible at any time.
A goal of the project is to have full VGA compatibility, enabling the use of
early colour games and applications.
The original target processor and system was an 80386. Significant
progress was made towards the CPU instructions and 32 bit memory
handling, but due to the vastly expanded 16 and 32 bit instruction set, a
goal shift to the 8086 was undertaken. This means that the goal of fully
emulating all 16 bit (200+) instructions is feasible in the timescale. As a
result of the goal shift, the VMM project has a 32 bit memory module for
future extensibility, such as the ability to access 4GB of extended memory.
The x86 Virtual Machine Monitor project is being developed by Jonathan
Whiting, Michael Whittaker, Alex Short and Tom Shepherd. Please direct
questions to Project Supervisor Bob Eager at [email protected].