From: Jack Lange Date: Tue, 26 Feb 2008 21:38:00 +0000 (+0000) Subject: added svm files X-Git-Tag: working-cdboot-physical-but-not-qemu~72 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=4d691866d964c028d2b2ca96c2d16489d45dd2b5 added svm files --- diff --git a/palacios/build/Makefile b/palacios/build/Makefile index a2b43d1..a91719c 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.7 $ +# $Revision: 1.8 $ # This is free software. You are permitted to use, # redistribute, and modify it as specified in the file "COPYING". @@ -98,13 +98,14 @@ 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 \ main.c # Kernel object files built from C source files KERNEL_C_OBJS := $(KERNEL_C_SRCS:%.c=geekos/%.o) # Kernel assembly files -KERNEL_ASM_SRCS := lowlevel.asm vmx_lowlevel.asm +KERNEL_ASM_SRCS := lowlevel.asm vmx_lowlevel.asm svm_lowlevel.asm KERNEL_GAS_SRCS := testvm.s diff --git a/palacios/build/depend.mak b/palacios/build/depend.mak index e69de29..97c01b0 100644 --- a/palacios/build/depend.mak +++ b/palacios/build/depend.mak @@ -0,0 +1,266 @@ +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 \ + ../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 \ + ../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 \ + ../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 \ + ../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 \ + ../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 \ + ../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 \ + ../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 +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 \ + ../include/geekos/string.h ../include/geekos/../libc/string.h \ + /usr/lib/gcc/i386-redhat-linux/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 \ + ../include/geekos/synch.h ../include/geekos/blockdev.h \ + ../include/geekos/fileio.h +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 \ + ../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 \ + ../include/geekos/io.h ../include/geekos/errno.h \ + ../include/geekos/malloc.h ../include/geekos/timer.h \ + ../include/geekos/kthread.h ../include/geekos/list.h \ + ../include/geekos/blockdev.h ../include/geekos/fileio.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 \ + ../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 \ + ../include/geekos/kassert.h ../include/geekos/screen.h \ + ../include/geekos/ktypes.h \ + /usr/lib/gcc/i386-redhat-linux/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 \ + ../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 +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 \ + ../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 \ + ../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 \ + ../include/geekos/ktypes.h \ + /usr/lib/gcc/i386-redhat-linux/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 \ + ../include/geekos/string.h ../include/geekos/../libc/string.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 \ + ../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 +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 \ + ../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 \ + ../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 \ + ../include/geekos/string.h ../include/geekos/../libc/string.h \ + /usr/lib/gcc/i386-redhat-linux/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 \ + ../include/geekos/kassert.h ../include/geekos/screen.h \ + ../include/geekos/ktypes.h \ + /usr/lib/gcc/i386-redhat-linux/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 \ + ../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 \ + ../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 \ + ../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 \ + ../include/geekos/kthread.h ../include/geekos/malloc.h \ + ../include/geekos/serial.h ../include/geekos/irq.h \ + ../include/geekos/io.h +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 \ + ../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 \ + ../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 +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 \ + ../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 \ + ../include/geekos/defs.h ../include/geekos/idt.h \ + ../include/geekos/kthread.h ../include/geekos/list.h \ + ../include/geekos/mem.h ../include/geekos/paging.h \ + ../include/geekos/bootinfo.h ../include/geekos/malloc.h \ + ../include/geekos/gdt.h ../include/geekos/segment.h \ + ../include/geekos/crc32.h ../include/geekos/serial.h \ + ../include/geekos/irq.h ../include/geekos/io.h ../include/geekos/vmcs.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 \ + ../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 \ + ../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 \ + ../include/geekos/segment.h ../include/geekos/gdt.h \ + ../include/geekos/idt.h ../include/geekos/cpu.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 \ + ../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 \ + ../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 \ + ../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 \ + ../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 \ + ../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 \ + ../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 \ + ../include/geekos/screen.h ../include/geekos/ktypes.h \ + /usr/lib/gcc/i386-redhat-linux/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 \ + ../include/geekos/tss.h ../include/geekos/int.h \ + ../include/geekos/kthread.h ../include/geekos/trap.h \ + ../include/geekos/timer.h ../include/geekos/keyboard.h \ + ../include/geekos/io.h ../include/geekos/serial.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/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 \ + ../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 +common/string.o: ../src/common/string.c ../include/libc/fmtout.h \ + /usr/lib/gcc/i386-redhat-linux/3.4.6/include/stdarg.h \ + ../include/libc/string.h \ + /usr/lib/gcc/i386-redhat-linux/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 diff --git a/palacios/include/geekos/svm.h b/palacios/include/geekos/svm.h new file mode 100644 index 0000000..e985ba0 --- /dev/null +++ b/palacios/include/geekos/svm.h @@ -0,0 +1,19 @@ +#ifndef __SVM_H +#define __SVM_H + +#include +#include + + +#define CPUID_ECX_FEATURE_IDS 0x80000001 +#define CPUID_SVM_AVAIL 0x00000004 + + + +void Init_SVM(); + + + + + +#endif diff --git a/palacios/include/geekos/vmcb.h b/palacios/include/geekos/vmcb.h new file mode 100644 index 0000000..9e7bf58 --- /dev/null +++ b/palacios/include/geekos/vmcb.h @@ -0,0 +1,175 @@ +#ifndef __VMCB_H +#define __VMCB_H + + + + +#if __TINYC__ +#define PACKED +#else +#define PACKED __attribute__((packed)) +#endif + +union Ctrl_Registers { + ushort_t bitmap PACKED; + struct { + uint_t cr0 : 1 PACKED; + uint_t cr1 : 1 PACKED; + uint_t cr2 : 1 PACKED; + uint_t cr3 : 1 PACKED; + uint_t cr4 : 1 PACKED; + uint_t cr5 : 1 PACKED; + uint_t cr6 : 1 PACKED; + uint_t cr7 : 1 PACKED; + uint_t cr8 : 1 PACKED; + uint_t cr9 : 1 PACKED; + uint_t cr10 : 1 PACKED; + uint_t cr11 : 1 PACKED; + uint_t cr12 : 1 PACKED; + uint_t cr13 : 1 PACKED; + uint_t cr14 : 1 PACKED; + uint_t cr15 : 1 PACKED; + } crs; +}; + + +union Debug_Registers { + ushort_t bitmap PACKED; + struct { + uint_t dr0 : 1 PACKED; + uint_t dr1 : 1 PACKED; + uint_t dr2 : 1 PACKED; + uint_t dr3 : 1 PACKED; + uint_t dr4 : 1 PACKED; + uint_t dr5 : 1 PACKED; + uint_t dr6 : 1 PACKED; + uint_t dr7 : 1 PACKED; + uint_t dr8 : 1 PACKED; + uint_t dr9 : 1 PACKED; + uint_t dr10 : 1 PACKED; + uint_t dr11 : 1 PACKED; + uint_t dr12 : 1 PACKED; + uint_t dr13 : 1 PACKED; + uint_t dr14 : 1 PACKED; + uint_t dr15 : 1 PACKED; + } drs; +}; + + +union Exception_Vectors { + ulong_t bitmap PACKED; + struct { + uint_t ex0 : 1 PACKED; + uint_t ex1 : 1 PACKED; + uint_t ex2 : 1 PACKED; + uint_t ex3 : 1 PACKED; + uint_t ex4 : 1 PACKED; + uint_t ex5 : 1 PACKED; + uint_t ex6 : 1 PACKED; + uint_t ex7 : 1 PACKED; + uint_t ex8 : 1 PACKED; + uint_t ex9 : 1 PACKED; + uint_t ex10 : 1 PACKED; + uint_t ex11 : 1 PACKED; + uint_t ex12 : 1 PACKED; + uint_t ex13 : 1 PACKED; + uint_t ex14 : 1 PACKED; + uint_t ex15 : 1 PACKED; + uint_t ex16 : 1 PACKED; + uint_t ex17 : 1 PACKED; + uint_t ex18 : 1 PACKED; + uint_t ex19 : 1 PACKED; + uint_t ex20 : 1 PACKED; + uint_t ex21 : 1 PACKED; + uint_t ex22 : 1 PACKED; + uint_t ex23 : 1 PACKED; + uint_t ex24 : 1 PACKED; + uint_t ex25 : 1 PACKED; + uint_t ex26 : 1 PACKED; + uint_t ex27 : 1 PACKED; + uint_t ex28 : 1 PACKED; + uint_t ex29 : 1 PACKED; + uint_t ex30 : 1 PACKED; + uint_t ex31 : 1 PACKED; + } exceptions; +}; + + +union Instr_Intercepts { + ulong_t bitmap PACKED; + struct { + uint_t INTR : 1 PACKED; + uint_t NMI : 1 PACKED; + uint_t SMI : 1 PACKED; + uint_t INIT : 1 PACKED; + uint_t VINTR : 1 PACKED; + uint_t CR0 : 1 PACKED; + uint_t RD_IDTR : 1 PACKED; + uint_t RD_GDTR : 1 PACKED; + uint_t RD_LDTR : 1 PACKED; + uint_t RD_TR : 1 PACKED; + uint_t WR_IDTR : 1 PACKED; + uint_t WR_GDTR : 1 PACKED; + uint_t WR_LDTR : 1 PACKED; + uint_t WR_TR : 1 PACKED; + uint_t RDTSC : 1 PACKED; + uint_t RDPMC : 1 PACKED; + uint_t PUSHF : 1 PACKED; + uint_t POPF : 1 PACKED; + uint_t CPUID : 1 PACKED; + uint_t RSM : 1 PACKED; + uint_t IRET : 1 PACKED; + uint_t INTn : 1 PACKED; + uint_t INVD : 1 PACKED; + uint_t PAUSE : 1 PACKED; + uint_t HLT : 1 PACKED; + uint_t INVPLG : 1 PACKED; + uint_t INVPLGA : 1 PACKED; + uint_t IOIO_PROT : 1 PACKED; + uint_t MSR_PROT : 1 PACKED; + uint_t task_switch : 1 PACKED; + uint_t FERR_FREEZE : 1 PACKED; + uint_t shutdown_evts: 1 PACKED; + } instrs; +}; + +union SVM_Instr_Intercepts { + ulong_t bitmap PACKED; + struct { + uint_t VMRUN : 1 PACKED; + uint_t VMMCALL : 1 PACKED; + uint_t VMLOAD : 1 PACKED; + uint_t VMSAVE : 1 PACKED; + uint_t STGI : 1 PACKED; + uint_t CLGI : 1 PACKED; + uint_t SKINIT : 1 PACKED; + uint_t RDTSCP : 1 PACKED; + uint_t ICEBP : 1 PACKED; + uint_t WBINVD : 1 PACKED; + uint_t MONITOR : 1 PACKED; + uint_t MWAIT_always : 1 PACKED; + uint_t MWAIT_if_armed : 1 PACKED; + ulong_t reserved : 19 PACKED; + } instrs; +}; + + + +typedef struct VMCB_Control_Area { + union Ctrl_Registers cr_reads PACKED; + union Ctrl_Registers cr_writes PACKED; + union Debug_Registers dr_reads PACKED; + union Debug_Registers dr_writes PACKED; + union Exception_Vectors exceptions PACKED; + union Instr_Intercepts instrs PACKED; + union SVM_Instr_Intercepts svm_instrs PACKED; + char rsvd1[43] PACKED; + + + +} svm_vmcb_t; + + + + +#endif diff --git a/palacios/include/geekos/vmx.h b/palacios/include/geekos/vmx.h index 62531a6..e82432c 100644 --- a/palacios/include/geekos/vmx.h +++ b/palacios/include/geekos/vmx.h @@ -97,7 +97,7 @@ struct Instruction { void DecodeCurrentInstruction(struct VM *vm, struct Instruction *out); -VmxOnRegion * InitVMX(); +VmxOnRegion * Init_VMX(); VmxOnRegion * CreateVmxOnRegion(); int VMLaunch(struct VMDescriptor *vm); diff --git a/palacios/src/geekos/main.c b/palacios/src/geekos/main.c index 3175861..ae6812a 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.8 $ + * $Revision: 1.9 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -335,7 +335,7 @@ void Main(struct Boot_Info* bootInfo) SerialPrintLevel(100,"Initializing VMX\n"); PrintBoth("Initializing VMX\n"); - VmxOnRegion * vmxRegion = InitVMX(); + VmxOnRegion * vmxRegion = Init_VMX(); if (vmxRegion==NULL) { PrintBoth("VMX Cannot be turned on. Halted.\n"); diff --git a/palacios/src/geekos/svm.c b/palacios/src/geekos/svm.c new file mode 100644 index 0000000..ae901bb --- /dev/null +++ b/palacios/src/geekos/svm.c @@ -0,0 +1,15 @@ +#include + + +extern uint_t cpuid_ecx(uint_t op); + +void Init_SVM() { + + uint_t ret = cpuid_ecx(CPUID_ECX_FEATURE_IDS); + + if (ret & CPUID_SVM_AVAIL) { + PrintBoth("SVM Available\n"); + } + + +} diff --git a/palacios/src/geekos/svm_lowlevel.asm b/palacios/src/geekos/svm_lowlevel.asm new file mode 100644 index 0000000..badc8f1 --- /dev/null +++ b/palacios/src/geekos/svm_lowlevel.asm @@ -0,0 +1,19 @@ +; -*- fundamental -*- + + +%ifndef SVM_ASM +%define SVM_ASM + +%include "defs.asm" +%include "symbol.asm" + + +[BITS 32] + + + + + + + +%endif diff --git a/palacios/src/geekos/vmx.c b/palacios/src/geekos/vmx.c index eb6c718..2bfdf1a 100644 --- a/palacios/src/geekos/vmx.c +++ b/palacios/src/geekos/vmx.c @@ -126,7 +126,7 @@ static int ExecFaultingInstructionInVMM(struct VM *vm) } -VmxOnRegion * InitVMX() { +VmxOnRegion * Init_VMX() { VmxOnRegion * region = NULL; unsigned int ret;