ChangeSet 1.1696, 2005/06/08 10:04:58+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx
The following allows you to run unmodified guest operating systems
under Xen on VMX (VT) enabled processors. The tree lives under
<ROOT>/tools/dfw. Instead of booting a guest kernel, boot vmxloader and
specify the disk image in qemurc.
Leendert
Signed-Off-By: Leendert van Doorn <leendert@xxxxxxxxxxxxxx>
Makefile | 25
README | 88
rombios/Makefile | 58
rombios/apmbios.S | 329 +
rombios/biossums.c | 478 +
rombios/makesym.perl | 31
rombios/rombios.c |10825 ++++++++++++++++++++++++++++++++++++++++++++
rombios/rombios.diffs | 101
vgabios/BUGS | 3
vgabios/COPYING | 504 ++
vgabios/ChangeLog | 1060 ++++
vgabios/Makefile | 80
vgabios/Notes | 11
vgabios/README | 191
vgabios/TODO | 28
vgabios/biossums.c | 200
vgabios/clext.c | 1587 ++++++
vgabios/dataseghack | 23
vgabios/vbe.c | 1068 ++++
vgabios/vbe.h | 302 +
vgabios/vbe_display_api.txt | 227
vgabios/vbetables.h | 1282 +++++
vgabios/vgabios.c | 3608 ++++++++++++++
vgabios/vgabios.h | 47
vgabios/vgafonts.h | 784 +++
vgabios/vgatables.h | 318 +
vmxassist/Makefile | 84
vmxassist/TODO | 8
vmxassist/gen.c | 52
vmxassist/head.S | 162
vmxassist/machine.h | 203
vmxassist/mkhex | 26
vmxassist/setup.c | 338 +
vmxassist/trap.S | 189
vmxassist/util.c | 364 +
vmxassist/util.h | 41
vmxassist/vm86.c | 956 +++
vmxassist/vm86.h | 67
vmxassist/vmxassist.ld | 34
vmxassist/vmxloader.c | 110
40 files changed, 25892 insertions(+)
diff -Nru a/tools/firmware/Makefile b/tools/firmware/Makefile
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/tools/firmware/Makefile 2005-06-08 06:03:18 -04:00
@@ -0,0 +1,25 @@
+XEN_ROOT = ../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+SUBDIRS :=
+SUBDIRS += rombios
+SUBDIRS += vgabios
+SUBDIRS += vmxassist
+
+.PHONY: all install clean
+
+all:
+ @set -e; for subdir in $(SUBDIRS); do \
+ $(MAKE) -C $$subdir $@; \
+ done
+
+install:
+ @set -e; for subdir in $(SUBDIRS); do \
+ $(MAKE) -C $$subdir $@; \
+ done
+
+clean:
+ @set -e; for subdir in $(SUBDIRS); do \
+ $(MAKE) -C $$subdir $@; \
+ done
+
diff -Nru a/tools/firmware/README b/tools/firmware/README
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/tools/firmware/README 2005-06-08 06:03:18 -04:00
@@ -0,0 +1,88 @@
+Domain FirmWare support
+-----------------------
+
+One of the key advantages of full virtualization hardware support (such
+as Intel's VT or AMD's Pacifica) is the ability to run unmodified guest
+operating systems. However, since most OSes rely on BIOS support during
+their early bringup, we need to provide a surrogate ROMBIOS and VGABIOS
+firmware layer.
+
+What's more, we need to support real-mode which is required by
+the firmware and bootstrap loaders. Real-mode support is especially
+challenging for Intel's VMX (VT) enabled CPUs where there is no real-mode
+support for VMX guest partitions. In this case you either have to do full
+emulation (full real-mode emulator; more complete but potentially slower)
+or partial emulation (use the VM8086 extensions, emulate only those
+instructions that are missing; faster, but potentially incomplete). The
+vmxassist code in this subdirectory uses the later approach because it
+is smaller and faster.
+
+The approach is relatively straight forward. Vmxloader contains three
+payloads (rombios, vgabios and vmxassist) and it is bootstrapped as any
+other 32-bit OS. Vmxloader copies its payloads to the addresses below
+and transfers control to vmxassist.
+
+ vgabios VGABIOS (standard and Cirrus).
+ Resides at C000:0000.
+
+ vmxassist VMXAssist VM86 realmode emulator for VMX.
+ Resides at D000:0000.
+
+ rombios ROMBIOS code. Derived from Bochs.
+ Resides at F000:0000
+
+Vmxassist first sets up it own world (GDT, IDT, TR, etc), enables
+VM8086 and then transfers control to F000:FFF0 and executes 16-bit
+code. Unsupported instructions cause a general protection failure at
+which point vmxassist kicks in and emulates the offending instruction.
+Whever the emulated code transitions to 32-bit protected mode, vmxassist
+will go away. Whenever 32-bit protected code transitions to real-mode,
+Xen/VMX will detect this and transfer control to vmxassist.
+
+Most of the vmxassist complexity comes from properly handling the
+real to protected mode and protected to real mode transitions and
+the proper emulation of the segment registers. Even though the Intel
+manual clearly states that you should immediately perform a jmp far
+after a mode transition, many operating systems execute additional
+instructions and some even refer to segment selectors and pop data
+from the stack. Vmxassist contains a number of work arounds for these
+OSes.
+
+
+Acknowledgements
+----------------
+
+The rombios was taken (largely unmodified) from Bochs, which was written
+by Kevin Lawton. The VGABIOS was written by Christophe Bothamy. Arun Sharma,
+Asit Mallick and Nitin Kamble (Intel) provided the E820 patches and lots
+of useful feedback.
+
+
+Contact
+-------
+
+Leendert van Doorn
+IBM T.J. Watson Research Center
+19 Skyline Drive
+Hawthorne, NY 10532
+leendert@xxxxxxxxxxxxxx
+
+
+Tested Operating Systems
+------------------------
+
+Since vmxassist uses partial emulation, it may always miss opcodes
+that are required by a particular OS. The table below lists the OSes
+I have tried. The Install column indicates a full CD/DVD install into
+a VMX partition. The Disk column indicates booting from prefabricated
+disk image.
+
+Operating System Install Disk
+------------------------------------------------------------
+RedHat Enterprise Linux (RHEL3_U5) Yes Yes
+Fedora Code (FC3) (-) Yes
+FreeBSD 5.3 (-) Yes
+MS-DOS 5.0 (-) Yes
+
+(-) not tried yet
+
diff -Nru a/tools/firmware/rombios/Makefile b/tools/firmware/rombios/Makefile
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/tools/firmware/rombios/Makefile 2005-06-08 06:03:18 -04:00
@@ -0,0 +1,58 @@
+BIOS_BUILDS = BIOS-bochs-latest
+#BIOS_BUILDS += BIOS-bochs-2-processors
+#BIOS_BUILDS += BIOS-bochs-4-processors
+#BIOS_BUILDS += BIOS-bochs-8-processors
+
+all: bios
+
+bios: biossums ${BIOS_BUILDS}
+
+clean:
+ rm -f *.o *.a *.s rombios.bin _rombios*_.c
+ rm -f as86-sym.txt ld86-sym.txt
+ rm -f rombios*.txt rombios*.sym usage biossums
+ rm -f BIOS-bochs-*
+
+BIOS-bochs-latest: rombios.c biossums
+ gcc -DBX_SMP_PROCESSORS=1 -E -P $< > _rombios_.c
+ bcc -o rombios.s -C-c -D__i86__ -0 -S _rombios_.c
+ sed -e 's/^\.text//' -e 's/^\.data//' rombios.s > _rombios_.s
+ as86 _rombios_.s -b tmp.bin -u- -w- -g -0 -j -O -l rombios.txt
+ -perl makesym.perl < rombios.txt > rombios.sym
+ mv tmp.bin BIOS-bochs-latest
+ ./biossums BIOS-bochs-latest
+ rm -f _rombios_.s
+
+BIOS-bochs-2-processors: rombios.c biossums
+ gcc -DBX_SMP_PROCESSORS=2 -E -P $< > _rombios2_.c
+ bcc -o rombios2.s -C-c -D__i86__ -0 -S _rombios2_.c
+ sed -e 's/^\.text//' -e 's/^\.data//' rombios2.s > _rombios2_.s
+ as86 _rombios2_.s -b tmp2.bin -u- -w- -g -0 -j -O -l rombios2.txt
+ -perl makesym.perl < rombios2.txt > rombios2.sym
+ mv tmp2.bin BIOS-bochs-2-processors
+ ./biossums BIOS-bochs-2-processors
+ rm -f _rombios2_.s
+
+BIOS-bochs-4-processors: rombios.c biossums
+ gcc -DBX_SMP_PROCESSORS=4 -E -P $< > _rombios4_.c
+ bcc -o rombios4.s -C-c -D__i86__ -0 -S _rombios4_.c
+ sed -e 's/^\.text//' -e 's/^\.data//' rombios4.s > _rombios4_.s
+ as86 _rombios4_.s -b tmp4.bin -u- -w- -g -0 -j -O -l rombios4.txt
+ -perl makesym.perl < rombios4.txt > rombios4.sym
+ mv tmp4.bin BIOS-bochs-4-processors
+ ./biossums BIOS-bochs-4-processors
+ rm -f _rombios4_.s
+
+BIOS-bochs-8-processors: rombios.c biossums
+ gcc -DBX_SMP_PROCESSORS=8 -E -P $< > _rombios8_.c
+ bcc -o rombios8.s -C-c -D__i86__ -0 -S _rombios8_.c
+ sed -e 's/^\.text//' -e 's/^\.data//' rombios8.s > _rombios8_.s
+ as86 _rombios8_.s -b tmp8.bin -u- -w- -g -0 -j -O -l rombios8.txt
+ -perl makesym.perl < rombios8.txt > rombios8.sym
+ mv tmp8.bin BIOS-bochs-8-processors
+ ./biossums BIOS-bochs-8-processors
+ rm -f _rombios8_.s
+
+biossums: biossums.c
+ gcc -o biossums biossums.c
+
diff -Nru a/tools/firmware/rombios/apmbios.S b/tools/firmware/rombios/apmbios.S
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/tools/firmware/rombios/apmbios.S 2005-06-08 06:03:18 -04:00
@@ -0,0 +1,329 @@
+// APM BIOS support for the Bochs BIOS
+// Copyright (C) 2004 Fabrice Bellard
+//
+// Debugging extensions, 16-bit interface and extended power options
+// Copyright (C) 2005 Struan Bartlett
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+#if defined(APM_REAL)
+#define APMSYM(s) apmreal_ ## s
+#elif defined(APM_PROT16)
+#define APMSYM(s) apm16_ ## s
+#elif defined(APM_PROT32)
+#define APMSYM(s) apm32_ ## s
+#else
+#error unsupported APM mode
+#endif
+
+APMSYM(out_str):
+ push eax
+ push ebx
+ mov ebx, eax
+APMSYM(out_str1):
+ SEG CS
+ mov al, byte ptr [bx]
+ cmp al, #0
+ je APMSYM(out_str2)
+ outb dx, al
+ inc ebx
+ jmp APMSYM(out_str1)
+APMSYM(out_str2):
+ pop ebx
+ pop eax
+ ret
+
+APMSYM(07_poweroff_str):
+ .ascii "Shutdown"
+ db 0
+APMSYM(07_suspend_str):
+ .ascii "Suspend"
+ db 0
+APMSYM(07_standby_str):
+ .ascii "Standby"
+ db 0
+
+#if DEBUG_APM
+APMSYM(put_str):
+ push edx
+ mov dx, #INFO_PORT
+ call APMSYM(out_str)
+ pop edx
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|