From: Jack Lange Date: Wed, 27 Feb 2008 21:58:18 +0000 (+0000) Subject: added generic VMM framework X-Git-Tag: working-cdboot-physical-but-not-qemu~69 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=8126d0d154dfd37ed7997f4fa78a1c179c4d2c81 added generic VMM framework --- diff --git a/palacios/build/Makefile b/palacios/build/Makefile index a91719c..fe40051 100644 --- a/palacios/build/Makefile +++ b/palacios/build/Makefile @@ -1,6 +1,6 @@ # Makefile for GeekOS kernel, userspace, and tools # Copyright (c) 2004,2005 David H. Hovemeyer -# $Revision: 1.8 $ +# $Revision: 1.9 $ # This is free software. You are permitted to use, # redistribute, and modify it as specified in the file "COPYING". @@ -23,7 +23,7 @@ # THESE MUST MATCH WHAT IS DEFINED IN defs.h and defs.asm exactly # MUST BE INTEGRAL NUMBER OF PAGES -TOP_OF_MEM := 0x40000000 +TOP_OF_MEM := 0x30000000 VM_SIZE := 0x20000000 VM_START := 0x0 @@ -98,7 +98,7 @@ KERNEL_C_SRCS := idt.c int.c trap.c irq.c io.c \ synch.c kthread.c \ serial.c reboot.c \ paging.c vmx.c vmcs_gen.c vmcs.c\ - svm.c \ + svm.c vmm.c\ main.c # Kernel object files built from C source files @@ -137,11 +137,12 @@ COMMON_C_OBJS := $(COMMON_C_SRCS:%.c=common/%.o) # ---------------------------------------------------------------------- # Uncomment if cross compiling -#TARGET_CC_PREFIX := i386-elf- +#TARGET_CC_PREFIX := $(PROJECT_ROOT)/../devtools/i386/bin/i386-elf- +#TARGET_CC_PREFIX := i386-elf- # Target C compiler. gcc 2.95.2 or later should work. -TARGET_CC := $(TARGET_CC_PREFIX)gcc -#TARGET_CC := $(TARGET_CC_PREFIX)gcc34 -m32 +#TARGET_CC := $(TARGET_CC_PREFIX)gcc +TARGET_CC := $(TARGET_CC_PREFIX)gcc34 -m32 # Host C compiler. This is used to compile programs to execute on # the host platform, not the target (x86) platform. On x86/ELF diff --git a/palacios/build/depend.mak b/palacios/build/depend.mak index 97c01b0..cc91343 100644 --- a/palacios/build/depend.mak +++ b/palacios/build/depend.mak @@ -1,45 +1,45 @@ geekos/idt.o: ../src/geekos/idt.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/defs.h ../include/geekos/idt.h \ ../include/geekos/int.h ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h geekos/int.o: ../src/geekos/int.c ../include/geekos/idt.h \ ../include/geekos/int.h ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/defs.h ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h ../include/geekos/vmcs.h \ ../include/geekos/vmcs_gen.h ../include/geekos/cpu.h geekos/trap.o: ../src/geekos/trap.c ../include/geekos/idt.h \ ../include/geekos/int.h ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/defs.h ../include/geekos/kthread.h \ ../include/geekos/list.h ../include/geekos/trap.h \ ../include/geekos/serial.h ../include/geekos/irq.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h geekos/irq.o: ../src/geekos/irq.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/idt.h ../include/geekos/int.h \ ../include/geekos/defs.h ../include/geekos/io.h ../include/geekos/irq.h geekos/io.o: ../src/geekos/io.c ../include/geekos/io.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h geekos/blockdev.o: ../src/geekos/blockdev.c ../include/geekos/errno.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/malloc.h ../include/geekos/int.h \ ../include/geekos/kassert.h ../include/geekos/defs.h \ ../include/geekos/kthread.h ../include/geekos/list.h \ @@ -49,10 +49,10 @@ geekos/ide.o: ../src/geekos/ide.c ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/int.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/defs.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h ../include/geekos/errno.h \ ../include/geekos/malloc.h ../include/geekos/timer.h \ ../include/geekos/kthread.h ../include/geekos/list.h \ @@ -60,50 +60,45 @@ geekos/ide.o: ../src/geekos/ide.c ../include/geekos/serial.h \ ../include/geekos/ide.h geekos/keyboard.o: ../src/geekos/keyboard.c ../include/geekos/kthread.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/list.h ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/irq.h \ ../include/geekos/int.h ../include/geekos/defs.h ../include/geekos/io.h \ ../include/geekos/keyboard.h geekos/screen.o: ../src/geekos/screen.c \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdarg.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/io.h ../include/geekos/int.h ../include/geekos/defs.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h geekos/timer.o: ../src/geekos/timer.c \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/limits.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/syslimits.h \ - /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/gnu/stubs.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h ../include/geekos/io.h \ - ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/limits.h \ + ../include/geekos/io.h ../include/geekos/ktypes.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/int.h ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/defs.h \ ../include/geekos/irq.h ../include/geekos/kthread.h \ ../include/geekos/list.h ../include/geekos/timer.h \ ../include/geekos/serial.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h geekos/mem.o: ../src/geekos/mem.c ../include/geekos/defs.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/bootinfo.h ../include/geekos/gdt.h \ ../include/geekos/int.h ../include/geekos/malloc.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/mem.h ../include/geekos/list.h \ ../include/geekos/paging.h ../include/geekos/vmm_sizes.h \ ../include/geekos/serial.h ../include/geekos/irq.h \ ../include/geekos/io.h geekos/crc32.o: ../src/geekos/crc32.c ../include/geekos/crc32.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/serial.h ../include/geekos/irq.h \ ../include/geekos/int.h ../include/geekos/defs.h \ @@ -111,54 +106,54 @@ geekos/crc32.o: ../src/geekos/crc32.c ../include/geekos/crc32.h \ ../include/geekos/io.h geekos/gdt.o: ../src/geekos/gdt.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/segment.h ../include/geekos/int.h \ ../include/geekos/defs.h ../include/geekos/tss.h \ ../include/geekos/gdt.h ../include/libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h geekos/tss.o: ../src/geekos/tss.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/defs.h ../include/geekos/gdt.h \ ../include/geekos/segment.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/tss.h ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/int.h ../include/geekos/io.h geekos/segment.o: ../src/geekos/segment.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/tss.h ../include/geekos/segment.h geekos/bget.o: ../src/geekos/bget.c ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/bget.h geekos/malloc.o: ../src/geekos/malloc.c ../include/geekos/screen.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/int.h ../include/geekos/kassert.h \ ../include/geekos/defs.h ../include/geekos/bget.h \ ../include/geekos/malloc.h geekos/synch.o: ../src/geekos/synch.c ../include/geekos/kthread.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/list.h ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/int.h \ ../include/geekos/defs.h ../include/geekos/synch.h geekos/kthread.o: ../src/geekos/kthread.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/defs.h ../include/geekos/int.h \ ../include/geekos/mem.h ../include/geekos/list.h \ ../include/geekos/paging.h ../include/geekos/bootinfo.h \ ../include/geekos/symbol.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/kthread.h ../include/geekos/malloc.h \ ../include/geekos/serial.h ../include/geekos/irq.h \ ../include/geekos/io.h @@ -166,21 +161,21 @@ geekos/serial.o: ../src/geekos/serial.c ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/int.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/defs.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h ../include/geekos/reboot.h \ ../include/geekos/gdt.h ../include/geekos/idt.h geekos/reboot.o: ../src/geekos/reboot.c ../include/geekos/reboot.h \ ../include/libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h geekos/paging.o: ../src/geekos/paging.c ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/int.h ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/defs.h ../include/geekos/idt.h \ ../include/geekos/kthread.h ../include/geekos/list.h \ ../include/geekos/mem.h ../include/geekos/paging.h \ @@ -191,13 +186,13 @@ geekos/paging.o: ../src/geekos/paging.c ../include/geekos/string.h \ ../include/geekos/vmcs_gen.h geekos/vmx.o: ../src/geekos/vmx.c ../include/geekos/vmx.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/vmcs.h ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/int.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/defs.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h ../include/geekos/vmcs_gen.h \ ../include/geekos/mem.h ../include/geekos/list.h \ ../include/geekos/paging.h ../include/geekos/bootinfo.h \ @@ -206,36 +201,36 @@ geekos/vmx.o: ../src/geekos/vmx.c ../include/geekos/vmx.h \ ../include/geekos/io_devs.h geekos/vmcs_gen.o: ../src/geekos/vmcs_gen.c ../include/geekos/vmcs_gen.h \ ../include/geekos/vmcs.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/serial.h ../include/geekos/irq.h \ ../include/geekos/int.h ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/defs.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h geekos/vmcs.o: ../src/geekos/vmcs.c ../include/geekos/vmcs.h \ ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/serial.h ../include/geekos/irq.h \ ../include/geekos/int.h ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/defs.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h ../include/geekos/vmcs_gen.h geekos/svm.o: ../src/geekos/svm.c ../include/geekos/svm.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/serial.h ../include/geekos/irq.h \ ../include/geekos/int.h ../include/geekos/kassert.h \ ../include/geekos/defs.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h geekos/main.o: ../src/geekos/main.c ../include/geekos/bootinfo.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdbool.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/mem.h ../include/geekos/defs.h \ ../include/geekos/list.h ../include/geekos/kassert.h \ ../include/geekos/paging.h ../include/geekos/crc32.h \ @@ -246,21 +241,17 @@ geekos/main.o: ../src/geekos/main.c ../include/geekos/bootinfo.h \ ../include/geekos/irq.h ../include/geekos/reboot.h \ ../include/geekos/ide.h ../include/geekos/vmx.h \ ../include/geekos/vmcs.h ../include/geekos/vmcs_gen.h \ + ../include/geekos/svm.h ../include/geekos/vmcb.h \ ../include/geekos/gdt.h ../include/geekos/vmm_sizes.h common/fmtout.o: ../src/common/fmtout.c \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdarg.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/limits.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/syslimits.h \ - /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/gnu/stubs.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h ../include/geekos/fmtout.h \ - ../include/geekos/../libc/fmtout.h + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/limits.h \ + ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h common/string.o: ../src/common/string.c ../include/libc/fmtout.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdarg.h \ + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h common/memmove.o: ../src/common/memmove.c ../include/libc/string.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h + /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h diff --git a/palacios/include/geekos/defs.h b/palacios/include/geekos/defs.h index e06cdf5..5d9bf89 100644 --- a/palacios/include/geekos/defs.h +++ b/palacios/include/geekos/defs.h @@ -1,7 +1,7 @@ /* * Misc. kernel definitions * Copyright (c) 2001,2004 David H. Hovemeyer - * $Revision: 1.2 $ + * $Revision: 1.3 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -86,7 +86,7 @@ TOP_OF_MEM: // This is for a 1 GB Machine // The last address (+1) at which physical memory ends -#define TOP_OF_MEM (0x40000000) +#define TOP_OF_MEM (0x30000000) // How much space to reserve for the VM #define VM_SIZE (0x20000000) // Where the VM starts in physical memory diff --git a/palacios/include/geekos/svm.h b/palacios/include/geekos/svm.h index e985ba0..f61ee6c 100644 --- a/palacios/include/geekos/svm.h +++ b/palacios/include/geekos/svm.h @@ -5,13 +5,48 @@ #include -#define CPUID_ECX_FEATURE_IDS 0x80000001 -#define CPUID_SVM_AVAIL 0x00000004 +#define CPUID_FEATURE_IDS 0x80000001 +#define CPUID_FEATURE_IDS_ecx_svm_avail 0x00000004 +#define CPUID_SVM_REV_AND_FEATURE_IDS 0x8000000a +#define CPUID_SVM_REV_AND_FEATURE_IDS_edx_svml 0x00000004 -void Init_SVM(); +#define EFER_MSR 0xc0000080 +#define EFER_MSR_svm_enable 0x00001000 + +/************/ +/* SVM MSRs */ +/************/ +/* AMD Arch Vol 3, sec. 15.28, pg 420 */ +/************/ + +/* SVM VM_CR MSR */ +#define SVM_VM_CR_MSR 0xc0010114 +#define SVM_VM_CR_MSR_dpd 0x00000001 +#define SVM_VM_CR_MSR_r_init 0x00000002 +#define SVM_VM_CR_MSR_dis_a20m 0x00000004 +#define SVM_VM_CR_MSR_lock 0x00000008 +#define SVM_VM_CR_MSR_svmdis 0x00000010 + +#define SVM_IGNNE_MSR 0xc0010115 + +/* SMM Signal Control Register */ +#define SVM_SMM_CTL_MSR 0xc0010116 +#define SVM_SMM_CTL_MSR_dismiss 0x00000001 +#define SVM_SMM_CTL_MSR_enter 0x00000002 +#define SVM_SMM_CTL_MSR_smi_cycle 0x00000004 +#define SVM_SMM_CTL_MSR_exit 0x00000008 +#define SVM_SMM_CTL_MSR_rsm_cycle 0x00000010 +#define SVM_VM_HSAVE_PA_MSR 0xc0010117 +#define SVM_KEY_MSR 0xc0010118 + +/* ** */ + + +void Init_SVM(); +int is_svm_capable(); diff --git a/palacios/include/geekos/vmm.h b/palacios/include/geekos/vmm.h new file mode 100644 index 0000000..6cc48e4 --- /dev/null +++ b/palacios/include/geekos/vmm.h @@ -0,0 +1,31 @@ +#ifndef __VMM_H +#define __VMM_H + + +#define VMM_INVALID_CPU 0 +#define VMM_VMX_CPU 1 +#define VMM_SVM_CPU 2 + + +/* This will contain function pointers that provide OS services */ +struct vmm_os_hooks { + + +}; + + + + +/* This will contain Function pointers that control the VMs */ +struct vmm_ctrl_ops { + + +}; + + + +void Init_VMM(); + + + +#endif diff --git a/palacios/include/geekos/vmm_sizes.h b/palacios/include/geekos/vmm_sizes.h index 166096d..39806c1 100644 --- a/palacios/include/geekos/vmm_sizes.h +++ b/palacios/include/geekos/vmm_sizes.h @@ -1,8 +1,8 @@ #ifndef __vmm_sizes #define __vmm_sizes -#define KERNEL_LOAD_ADDRESS 0x3fe9d000 +#define KERNEL_LOAD_ADDRESS 0x2fe9d000 #define KERNEL_START (KERNEL_LOAD_ADDRESS) -#define KERNEL_CORE_LENGTH ( 211 *512) +#define KERNEL_CORE_LENGTH ( 230 *512) #define KERNEL_END (KERNEL_LOAD_ADDRESS+KERNEL_CORE_LENGTH-1) #define VM_KERNEL_LENGTH ( 97 *512) #define VM_KERNEL_START (KERNEL_LOAD_ADDRESS + KERNEL_CORE_LENGTH) diff --git a/palacios/include/geekos/vmx.h b/palacios/include/geekos/vmx.h index e82432c..4a8ae25 100644 --- a/palacios/include/geekos/vmx.h +++ b/palacios/include/geekos/vmx.h @@ -97,6 +97,8 @@ struct Instruction { void DecodeCurrentInstruction(struct VM *vm, struct Instruction *out); +int is_vmx_capable(); + VmxOnRegion * Init_VMX(); VmxOnRegion * CreateVmxOnRegion(); diff --git a/palacios/src/geekos/defs.asm b/palacios/src/geekos/defs.asm index 73483b6..ff863e2 100644 --- a/palacios/src/geekos/defs.asm +++ b/palacios/src/geekos/defs.asm @@ -1,6 +1,6 @@ ; Definitions for use in GeekOS boot code ; Copyright (c) 2001, David H. Hovemeyer -; $Revision: 1.4 $ +; $Revision: 1.5 $ ; This is free software. You are permitted to use, ; redistribute, and modify it as specified in the file "COPYING". @@ -16,7 +16,7 @@ %ifndef DEFS_ASM %define DEFS_ASM -TOP_OF_MEM equ 0x40000000 +TOP_OF_MEM equ 0x30000000 VM_SIZE equ 0x20000000 START_OF_VM equ 0x0 VM_KERNEL_TARGET equ 0x100000 diff --git a/palacios/src/geekos/int.c b/palacios/src/geekos/int.c index 319017b..b4016f6 100644 --- a/palacios/src/geekos/int.c +++ b/palacios/src/geekos/int.c @@ -1,7 +1,7 @@ /* * GeekOS interrupt handling data structures and functions * Copyright (c) 2001,2003 David H. Hovemeyer - * $Revision: 1.1 $ + * $Revision: 1.2 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -37,11 +37,11 @@ static void Dummy_Interrupt_Handler(struct Interrupt_State* state) Print("Unexpected Interrupt! Ignoring!\n"); SerialPrint("*** Unexpected interrupt! *** Ignoring!\n"); Dump_Interrupt_State(state); - SerialPrint_VMCS_ALL(); + // SerialPrint_VMCS_ALL(); End_IRQ(state); - - // STOP(); + + //STOP(); } #if 0 @@ -82,6 +82,10 @@ void Init_Interrupts(void) Install_Interrupt_Handler(i, Dummy_Interrupt_Handler); } + /* JRL */ + // Disable_IRQ(7); + /* ** */ + /* Re-enable interrupts */ Enable_Interrupts(); } @@ -102,7 +106,7 @@ void Dump_Interrupt_State(struct Interrupt_State* state) { uint_t errorCode = state->errorCode; - SerialPrint("eax=%08x ebx=%08x ecx=%08x edx=%08x\n" + Print("eax=%08x ebx=%08x ecx=%08x edx=%08x\n" "esi=%08x edi=%08x ebp=%08x\n" "eip=%08x cs=%08x eflags=%08x\n" "Interrupt number=%d (%s), error code=%d\n" @@ -113,6 +117,8 @@ void Dump_Interrupt_State(struct Interrupt_State* state) state->intNum, exception_names[state->intNum], errorCode, errorCode >> 3, (errorCode >> 2) & 1, (errorCode >> 1) & 1, errorCode & 1 ); + + if (Is_User_Interrupt(state)) { struct User_Interrupt_State *ustate = (struct User_Interrupt_State*) state; SerialPrint("user esp=%08x, user ss=%08x\n", ustate->espUser, ustate->ssUser); @@ -122,4 +128,7 @@ void Dump_Interrupt_State(struct Interrupt_State* state) SerialPrint_Selector("es", state->es); SerialPrint_Selector("fs", state->fs); SerialPrint_Selector("gs", state->gs); + + + } diff --git a/palacios/src/geekos/lowlevel.asm b/palacios/src/geekos/lowlevel.asm index 63f93c2..f90212c 100644 --- a/palacios/src/geekos/lowlevel.asm +++ b/palacios/src/geekos/lowlevel.asm @@ -2,7 +2,7 @@ ; Low level interrupt/thread handling code for GeekOS. ; Copyright (c) 2001,2003,2004 David H. Hovemeyer ; Copyright (c) 2003, Jeffrey K. Hollingsworth -; $Revision: 1.1 $ +; $Revision: 1.2 $ ; This is free software. You are permitted to use, ; redistribute, and modify it as specified in the file "COPYING". @@ -165,6 +165,7 @@ EXPORT Flush_TLB ; CPUID functions EXPORT cpuid_ecx EXPORT cpuid_eax +EXPORT cpuid_edx ; Utility Functions EXPORT Set_MSR @@ -269,6 +270,23 @@ Flush_TLB: ret + +; +; cpuid_edx - return the edx register from cpuid +; +align 8 +cpuid_edx: + push ebp + mov ebp, esp + push edx + mov eax, [ebp + 8] + cpuid + mov eax, edx + pop edx + pop ebp + ret + + ; ; cpuid_ecx - return the ecx register from cpuid ; diff --git a/palacios/src/geekos/main.c b/palacios/src/geekos/main.c index ae6812a..2cd5a6a 100644 --- a/palacios/src/geekos/main.c +++ b/palacios/src/geekos/main.c @@ -3,7 +3,7 @@ * Copyright (c) 2001,2003,2004 David H. Hovemeyer * Copyright (c) 2003, Jeffrey K. Hollingsworth * Copyright (c) 2004, Iulian Neamtiu - * $Revision: 1.9 $ + * $Revision: 1.10 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -27,8 +27,7 @@ #include #include -#include -#include +#include #include @@ -206,7 +205,7 @@ extern char BSS_START, BSS_END; extern char end; - +/* void VM_Thread(ulong_t arg) { int ret; @@ -245,7 +244,7 @@ void VM_Thread(ulong_t arg) while (1) {} } - +*/ int AllocateAndMapPagesForRange(uint_t start, uint_t length, pte_t template_pte) { @@ -277,15 +276,11 @@ void Main(struct Boot_Info* bootInfo) { struct Kernel_Thread * key_thread; struct Kernel_Thread * spkr_thread; - struct Kernel_Thread * vm_thread; - struct VMDescriptor vm; + // struct Kernel_Thread * vm_thread; + // struct VMDescriptor vm; ulong_t doIBuzz = 0; - - - - Init_BSS(); Init_Screen(); @@ -306,8 +301,6 @@ void Main(struct Boot_Info* bootInfo) Print("Done; stalling\n"); - // while(1); - #if 0 @@ -333,15 +326,8 @@ void Main(struct Boot_Info* bootInfo) SerialPrint("\n\n===>"); - SerialPrintLevel(100,"Initializing VMX\n"); - PrintBoth("Initializing VMX\n"); - VmxOnRegion * vmxRegion = Init_VMX(); - if (vmxRegion==NULL) { - PrintBoth("VMX Cannot be turned on. Halted.\n"); - while (1) {} - } - + Init_VMM(); SerialPrintLevel(1000,"Launching Noisemaker and keyboard listener threads\n"); @@ -383,6 +369,7 @@ void Main(struct Boot_Info* bootInfo) //SerialPrintLevel(1000, "VM copied\n"); + /* // jump into vmxassist vm.entry_ip=(uint_t)0x00107fd0; vm.exit_eip=0; @@ -396,19 +383,18 @@ void Main(struct Boot_Info* bootInfo) vm.guest_esp -= 4; *(unsigned int *)(vm.guest_esp) = vm.entry_ip; // vm.guest_esp -= 4; - + SerialMemDump((unsigned char *)vm.entry_ip, 512); - + */ - vm_thread = Start_Kernel_Thread(VM_Thread, (ulong_t)&vm,PRIORITY_NORMAL,false); + // vm_thread = Start_Kernel_Thread(VM_Thread, (ulong_t)&vm,PRIORITY_NORMAL,false); SerialPrintLevel(1000,"Next: setup GDT\n"); - TODO("Write a Virtual Machine Monitor"); diff --git a/palacios/src/geekos/svm.c b/palacios/src/geekos/svm.c index ae901bb..3f9d278 100644 --- a/palacios/src/geekos/svm.c +++ b/palacios/src/geekos/svm.c @@ -2,14 +2,47 @@ extern uint_t cpuid_ecx(uint_t op); +extern uint_t cpuid_edx(uint_t op); +extern void Get_MSR(uint_t MSR, ulong_t * high_byte, ulong_t * low_byte); +extern void Set_MSR(uint_t MSR, ulong_t high_byte, ulong_t low_byte); -void Init_SVM() { +/* Checks machine SVM capability */ +/* Implemented from: AMD Arch Manual 3, sect 15.4 */ +int is_svm_capable() { + uint_t ret = cpuid_ecx(CPUID_FEATURE_IDS); + ulong_t vm_cr_low = 0, vm_cr_high = 0; + + + if ((ret & CPUID_FEATURE_IDS_ecx_svm_avail) == 0) { + Print("SVM Not Available\n"); + return 0; + } - uint_t ret = cpuid_ecx(CPUID_ECX_FEATURE_IDS); + Get_MSR(SVM_VM_CR_MSR, &vm_cr_high, &vm_cr_low); + + if ((vm_cr_low & SVM_VM_CR_MSR_svmdis) == 0) { + return 1; + } - if (ret & CPUID_SVM_AVAIL) { - PrintBoth("SVM Available\n"); + ret = cpuid_edx(CPUID_SVM_REV_AND_FEATURE_IDS); + + if ((ret & CPUID_SVM_REV_AND_FEATURE_IDS_edx_svml) == 0) { + Print("SVM BIOS Disabled, not unlockable\n"); + } else { + Print("SVM is locked with a key\n"); } + return 0; +} + +void Init_SVM() { + ulong_t msr_val_low = 0, msr_val_high = 0; + + Get_MSR(EFER_MSR, &msr_val_high, &msr_val_low); + msr_val_low |= EFER_MSR_svm_enable; + Set_MSR(EFER_MSR, 0, msr_val_low); + + Print("SVM Inited\n"); + return; } diff --git a/palacios/src/geekos/vmm.c b/palacios/src/geekos/vmm.c new file mode 100644 index 0000000..70f5156 --- /dev/null +++ b/palacios/src/geekos/vmm.c @@ -0,0 +1,23 @@ +#include +#include +#include + +uint_t vmm_cpu_type; + + + +void Init_VMM() { + vmm_cpu_type = VMM_INVALID_CPU; + + if (is_svm_capable()) { + vmm_cpu_type = VMM_SVM_CPU; + Print("Machine is SVM Capable\n"); + Init_SVM(); + } else if (is_vmx_capable()) { + vmm_cpu_type = VMM_VMX_CPU; + Print("Machine is VMX Capable\n"); + Init_VMX(); + } else { + PrintBoth("CPU has no virtualization Extensions\n"); + } +} diff --git a/palacios/src/geekos/vmx.c b/palacios/src/geekos/vmx.c index 2bfdf1a..e5f08c3 100644 --- a/palacios/src/geekos/vmx.c +++ b/palacios/src/geekos/vmx.c @@ -126,10 +126,8 @@ static int ExecFaultingInstructionInVMM(struct VM *vm) } -VmxOnRegion * Init_VMX() { - VmxOnRegion * region = NULL; - - unsigned int ret; +int is_vmx_capable() { + uint_t ret; union VMX_MSR featureMSR; ret = cpuid_ecx(1); @@ -137,15 +135,26 @@ VmxOnRegion * Init_VMX() { Get_MSR(IA32_FEATURE_CONTROL_MSR, &featureMSR.regs.high, &featureMSR.regs.low); SerialPrintLevel(100,"MSRREGlow: 0x%.8x\n", featureMSR.regs.low); + if ((featureMSR.regs.low & FEATURE_CONTROL_VALID) != FEATURE_CONTROL_VALID) { PrintBoth("VMX is locked -- enable in the BIOS\n"); - return NULL; + return 0; } } else { PrintBoth("VMX not supported on this cpu\n"); - return NULL; + return 0; } + return 1; + +} + + +VmxOnRegion * Init_VMX() { + uint_t ret; + VmxOnRegion * region = NULL; + + region = CreateVmxOnRegion();