From: Peter Dinda Date: Sat, 12 Apr 2008 01:11:28 +0000 (+0000) Subject: Added devices, device manager, and nvram device X-Git-Tag: working-cdboot-physical-but-not-qemu~20 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=7841dc573457c334a0f3b6e9186d26b1776c400f Added devices, device manager, and nvram device --- diff --git a/palacios/build/Makefile b/palacios/build/Makefile index 59e47a8..4b69f38 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.23 $ +# $Revision: 1.24 $ # This is free software. You are permitted to use, # redistribute, and modify it as specified in the file "COPYING". @@ -125,13 +125,21 @@ VMM_C_SRCS := vm_guest.c \ svm.c svm_handler.c vmm.c vmm_util.c svm_ctrl_regs.c \ vmcb.c vmm_mem.c vmm_paging.c vmm_io.c vmm_debug.c svm_io.c \ vmm_intr.c \ - vmm_shadow_paging.c vm_guest_mem.c #\ + vmm_shadow_paging.c vm_guest_mem.c \ + vmm_dev.c vmm_dev_mgr.c \ +#\ # vmx.c vmcs_gen.c vmcs.c VMM_C_OBJS := $(VMM_C_SRCS:%.c=palacios/%.o) VMM_OBJS := $(VMM_C_OBJS) $(VMM_ASM_OBJS) +DEVICE_C_SRCS := nvram.c + +DEVICE_C_OBJS := $(DEVICE_C_SRCS:%.c=devices/%.o) + +DEVICE_OBJS := $(DEVICE_C_OBJS) $(VMM_ASM_OBJS) + # ---------------------------------------------------------------------- @@ -250,6 +258,12 @@ palacios/%.o : palacios/%.c palacios/%.o : palacios/%.asm $(NASM) $(NASM_VMM_OPTS) $< -o palacios/$*.o +devices/%.o : devices/%.c + $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_VMM_OPTS) $< -o palacios/$*.o + +devices/%.o : devices/%.asm + $(NASM) $(NASM_VMM_OPTS) $< -o palacios/$*.o + # ---------------------------------------------------------------------- # Targets - # Specifies files to be built @@ -310,7 +324,7 @@ geekos/kernel.bin : geekos/kernel.exe $(PAD) $@ 512 # The kernel executable and symbol map. -geekos/kernel.exe : $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) +geekos/kernel.exe : $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) $(DEVICE_OBJS) $(TARGET_LD) -o geekos/kernel.exe -Ttext $(KERNEL_BASE_ADDR) -e $(KERNEL_ENTRY) \ $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) $(TARGET_NM) geekos/kernel.exe > geekos/kernel.syms @@ -328,7 +342,7 @@ vm_kernel: force # Clean build directories of generated files clean : - for d in geekos common libc user tools palacios; do \ + for d in geekos common libc user tools palacios devices; do \ (cd $$d && rm -f *); \ done @@ -348,6 +362,10 @@ depend : $(GENERATED_LIBC_SRCS) $(VMM_C_SRCS:%.c=$(PROJECT_ROOT)/src/palacios/%.c) \ | $(PERL) -n -e 's,^(\S),palacios/$$1,;print' \ >> depend.mak + $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \ + $(DEVICE_C_SRCS:%.c=$(PROJECT_ROOT)/src/devices/%.c) \ + | $(PERL) -n -e 's,^(\S),devices/$$1,;print' \ + >> depend.mak # By default, there are no header file dependencies. depend.mak : diff --git a/palacios/build/depend.mak b/palacios/build/depend.mak index 689ab65..08b1c02 100644 --- a/palacios/build/depend.mak +++ b/palacios/build/depend.mak @@ -1,55 +1,55 @@ geekos/idt.o: ../src/geekos/idt.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h ../include/geekos/debug.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/defs.h ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h ../include/geekos/debug.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h ../include/geekos/debug.h geekos/irq.o: ../src/geekos/irq.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h + /home/pdinda/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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/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 \ @@ -59,12 +59,12 @@ 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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/defs.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/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 \ @@ -72,133 +72,133 @@ 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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/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/fmtout.h \ ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ ../include/geekos/io.h ../include/geekos/int.h ../include/geekos/defs.h \ ../include/geekos/debug.h ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h geekos/timer.o: ../src/geekos/timer.c \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/limits.h \ + /home/pdinda/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 \ + /home/pdinda/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/fmtout.h \ ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/debug.h geekos/mem.o: ../src/geekos/mem.c ../include/geekos/defs.h \ ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/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/serial.h \ ../include/geekos/irq.h ../include/geekos/io.h \ ../include/geekos/debug.h geekos/crc32.o: ../src/geekos/crc32.c ../include/geekos/crc32.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 ../include/geekos/debug.h geekos/gdt.o: ../src/geekos/gdt.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/debug.h ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h ../include/geekos/io.h geekos/tss.o: ../src/geekos/tss.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/defs.h ../include/geekos/gdt.h \ ../include/geekos/segment.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/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 \ ../include/geekos/debug.h geekos/segment.o: ../src/geekos/segment.c ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/bget.h geekos/malloc.o: ../src/geekos/malloc.c ../include/geekos/screen.h \ ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/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/fmtout.h \ ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/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 ../include/geekos/debug.h @@ -206,25 +206,25 @@ 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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/defs.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h + /home/pdinda/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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ @@ -237,33 +237,54 @@ geekos/debug.o: ../src/geekos/debug.c ../include/geekos/debug.h \ ../include/geekos/serial.h ../include/geekos/irq.h \ ../include/geekos/int.h ../include/geekos/kassert.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/defs.h ../include/geekos/string.h \ ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h geekos/vmm_stubs.o: ../src/geekos/vmm_stubs.c ../include/geekos/vmm_stubs.h \ ../include/geekos/mem.h ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/defs.h ../include/geekos/list.h \ ../include/geekos/kassert.h ../include/geekos/screen.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/geekos/paging.h ../include/geekos/bootinfo.h \ ../include/geekos/malloc.h ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/int.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/io.h +geekos/vm.o: ../src/geekos/vm.c ../include/geekos/vmm_stubs.h \ + ../include/geekos/mem.h ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/geekos/defs.h ../include/geekos/list.h \ + ../include/geekos/kassert.h ../include/geekos/screen.h \ + ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + ../include/geekos/paging.h ../include/geekos/bootinfo.h \ + ../include/geekos/malloc.h ../include/palacios/vmm.h \ + ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_mem.h ../include/palacios/vmm_types.h \ + ../include/palacios/vm_guest.h ../include/palacios/vmm_io.h \ + ../include/palacios/vmm_util.h ../include/palacios/vmm_shadow_paging.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h ../include/geekos/debug.h \ + ../include/geekos/serial.h ../include/geekos/irq.h \ + ../include/geekos/int.h ../include/geekos/string.h \ + ../include/geekos/../libc/string.h ../include/geekos/io.h \ + ../include/geekos/vm.h geekos/main.o: ../src/geekos/main.c ../include/geekos/bootinfo.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/screen.h ../include/geekos/ktypes.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/geekos/fmtout.h ../include/geekos/../libc/fmtout.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.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 \ @@ -273,170 +294,214 @@ geekos/main.o: ../src/geekos/main.c ../include/geekos/bootinfo.h \ ../include/geekos/io.h ../include/geekos/serial.h \ ../include/geekos/irq.h ../include/geekos/reboot.h \ ../include/geekos/ide.h ../include/geekos/malloc.h \ - ../include/geekos/debug.h ../include/palacios/vmm.h \ - ../include/palacios/vmm_types.h ../include/palacios/vmm_mem.h \ - ../include/palacios/vm_guest.h ../include/palacios/vmm_io.h \ - ../include/palacios/vmm_util.h ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h ../include/geekos/gdt.h \ - ../include/geekos/vmm_stubs.h + ../include/geekos/debug.h ../include/geekos/vm.h \ + ../include/geekos/gdt.h common/fmtout.o: ../src/common/fmtout.c \ - /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 \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/limits.h \ + /home/pdinda/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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \ ../include/libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h + /home/pdinda/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 \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h palacios/vm_guest.o: ../src/palacios/vm_guest.c ../include/palacios/vm_guest.h \ ../include/palacios/vmm_mem.h ../include/palacios/vmm_types.h \ + ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h palacios/svm.o: ../src/palacios/svm.c ../include/palacios/svm.h \ ../include/palacios/vmm_util.h ../include/palacios/vmm_types.h \ - ../include/palacios/vmm.h ../include/geekos/string.h \ - ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vmm_mem.h ../include/palacios/vm_guest.h \ ../include/palacios/vmm_io.h ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h ../include/palacios/vmcb.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h ../include/palacios/vmcb.h \ ../include/palacios/svm_handler.h ../include/palacios/vmm_debug.h \ ../include/palacios/vm_guest_mem.h palacios/svm_handler.o: ../src/palacios/svm_handler.c \ ../include/palacios/svm_handler.h ../include/palacios/svm.h \ ../include/palacios/vmm_util.h ../include/palacios/vmm_types.h \ - ../include/palacios/vmm.h ../include/geekos/string.h \ - ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vmm_mem.h ../include/palacios/vm_guest.h \ ../include/palacios/vmm_io.h ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h ../include/palacios/vmcb.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h ../include/palacios/vmcb.h \ + ../include/palacios/vm_guest_mem.h ../include/palacios/vmm_emulate.h \ ../include/palacios/svm_ctrl_regs.h ../include/palacios/svm_io.h palacios/vmm.o: ../src/palacios/vmm.c ../include/palacios/vmm.h \ - ../include/palacios/vmm_types.h ../include/geekos/string.h \ - ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ - ../include/palacios/vmm_mem.h ../include/palacios/vm_guest.h \ - ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ - ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h ../include/palacios/svm.h \ + ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_mem.h ../include/palacios/vmm_types.h \ + ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vm_guest.h ../include/palacios/vmm_io.h \ + ../include/palacios/vmm_util.h ../include/palacios/vmm_shadow_paging.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h ../include/palacios/svm.h \ ../include/palacios/vmcb.h ../include/palacios/vmx.h \ ../include/palacios/vmcs.h ../include/palacios/vmcs_gen.h palacios/vmm_util.o: ../src/palacios/vmm_util.c ../include/palacios/vmm_util.h \ - ../include/palacios/vmm_types.h ../include/palacios/vmm.h \ - ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_types.h ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vmm_mem.h ../include/palacios/vm_guest.h \ ../include/palacios/vmm_io.h ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h palacios/svm_ctrl_regs.o: ../src/palacios/svm_ctrl_regs.c \ ../include/palacios/svm_ctrl_regs.h ../include/palacios/vm_guest.h \ ../include/palacios/vmm_mem.h ../include/palacios/vmm_types.h \ + ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h ../include/palacios/vmm.h \ - ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h ../include/palacios/vmm.h \ + ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vmcb.h ../include/palacios/vmm_emulate.h \ ../include/palacios/vm_guest_mem.h ../include/palacios/vmm_ctrl_regs.h palacios/vmcb.o: ../src/palacios/vmcb.c ../include/palacios/vmcb.h \ - ../include/palacios/vmm_types.h ../include/palacios/vmm.h \ - ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_types.h ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vmm_mem.h ../include/palacios/vm_guest.h \ ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h palacios/vmm_mem.o: ../src/palacios/vmm_mem.c ../include/palacios/vmm_mem.h \ - ../include/palacios/vmm_types.h ../include/palacios/vmm.h \ - ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_types.h ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vm_guest.h ../include/palacios/vmm_io.h \ ../include/palacios/vmm_util.h ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h palacios/vmm_paging.o: ../src/palacios/vmm_paging.c \ ../include/palacios/vmm_paging.h ../include/palacios/vmm_types.h \ + ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/palacios/vmm_mem.h ../include/palacios/vmm_util.h \ - ../include/palacios/vmm.h ../include/geekos/string.h \ - ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vm_guest.h ../include/palacios/vmm_io.h \ - ../include/palacios/vmm_shadow_paging.h \ + ../include/palacios/vmm_shadow_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h \ ../include/palacios/vm_guest_mem.h palacios/vmm_io.o: ../src/palacios/vmm_io.c ../include/palacios/vmm_io.h \ - ../include/palacios/vmm_types.h ../include/palacios/vmm_util.h \ - ../include/palacios/vmm_string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ - ../include/palacios/vmm.h ../include/geekos/string.h \ - ../include/geekos/../libc/string.h ../include/palacios/vmm_mem.h \ + ../include/palacios/vmm_types.h ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm_util.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_mem.h \ ../include/palacios/vm_guest.h ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h palacios/vmm_debug.o: ../src/palacios/vmm_debug.c ../include/palacios/vmm_debug.h \ - ../include/palacios/vmm.h ../include/palacios/vmm_types.h \ - ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ - ../include/palacios/vmm_mem.h ../include/palacios/vm_guest.h \ - ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ - ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_mem.h ../include/palacios/vmm_types.h \ + ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vm_guest.h ../include/palacios/vmm_io.h \ + ../include/palacios/vmm_util.h ../include/palacios/vmm_shadow_paging.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h palacios/svm_io.o: ../src/palacios/svm_io.c ../include/palacios/svm_io.h \ ../include/palacios/vm_guest.h ../include/palacios/vmm_mem.h \ - ../include/palacios/vmm_types.h ../include/palacios/vmm_io.h \ - ../include/palacios/vmm_util.h ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h ../include/palacios/vmcb.h \ - ../include/palacios/vmm.h ../include/geekos/string.h \ - ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_types.h ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ + ../include/palacios/vmm_shadow_paging.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h ../include/palacios/vmcb.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vmm_ctrl_regs.h ../include/palacios/vmm_emulate.h \ ../include/palacios/vm_guest_mem.h +palacios/vmm_intr.o: ../src/palacios/vmm_intr.c ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_types.h ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vm_guest.h ../include/palacios/vmm_mem.h \ + ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ + ../include/palacios/vmm_shadow_paging.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h palacios/vmm_shadow_paging.o: ../src/palacios/vmm_shadow_paging.c \ ../include/palacios/vmm_shadow_paging.h ../include/palacios/vmm_util.h \ - ../include/palacios/vmm_types.h ../include/palacios/vmm_paging.h \ - ../include/palacios/vmm_mem.h ../include/palacios/vmm.h \ - ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_types.h ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_mem.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vm_guest.h ../include/palacios/vmm_io.h \ + ../include/palacios/vmm_intr.h ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h \ ../include/palacios/vm_guest_mem.h palacios/vm_guest_mem.o: ../src/palacios/vm_guest_mem.c \ ../include/palacios/vm_guest_mem.h ../include/palacios/vm_guest.h \ ../include/palacios/vmm_mem.h ../include/palacios/vmm_types.h \ - ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ - ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h ../include/palacios/vmm.h \ - ../include/geekos/string.h ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h -palacios/vmx.o: ../src/palacios/vmx.c ../include/geekos/cpu.h \ - ../include/geekos/io_devs.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/palacios/vmx.h ../include/palacios/vmm_types.h \ - ../include/palacios/vmcs.h ../include/palacios/vmcs_gen.h \ - ../include/palacios/vmm.h ../include/geekos/string.h \ - ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ - ../include/palacios/vmm_mem.h ../include/palacios/vm_guest.h \ - ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ - ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h ../include/palacios/vmm_string.h -palacios/vmcs_gen.o: ../src/palacios/vmcs_gen.c ../include/palacios/vmcs_gen.h \ - ../include/palacios/vmcs.h ../include/palacios/vmm_types.h \ - ../include/palacios/vmm.h ../include/geekos/string.h \ - ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ - ../include/palacios/vmm_mem.h ../include/palacios/vm_guest.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h -palacios/vmcs.o: ../src/palacios/vmcs.c ../include/palacios/vmcs.h \ - ../include/palacios/vmm_types.h ../include/palacios/vmcs_gen.h \ - ../include/palacios/vmm.h ../include/geekos/string.h \ - ../include/geekos/../libc/string.h \ - /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h ../include/palacios/vmm.h \ + ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h +palacios/vmm_dev.o: ../src/palacios/vmm_dev.c ../include/palacios/vmm_dev.h \ + ../include/palacios/vmm_types.h ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h +palacios/vmm_dev_mgr.o: ../src/palacios/vmm_dev_mgr.c \ + ../include/palacios/vmm_dev.h ../include/palacios/vmm_types.h \ + ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h ../include/palacios/vm_guest.h \ + ../include/palacios/vmm_mem.h ../include/palacios/vmm_io.h \ + ../include/palacios/vmm_util.h ../include/palacios/vmm_shadow_paging.h \ + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h +devices/nvram.o: ../src/devices/nvram.c ../include/devices/nvram.h \ + ../include/palacios/vmm_dev.h ../include/palacios/vmm_types.h \ + ../include/geekos/ktypes.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \ + ../include/palacios/vmm.h ../include/palacios/vmm_string.h \ + /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \ ../include/palacios/vmm_mem.h ../include/palacios/vm_guest.h \ ../include/palacios/vmm_io.h ../include/palacios/vmm_util.h \ ../include/palacios/vmm_shadow_paging.h \ - ../include/palacios/vmm_paging.h + ../include/palacios/vmm_paging.h ../include/palacios/vmm_intr.h \ + ../include/palacios/vmm_dev_mgr.h \ + ../include/palacios/vmm_device_types.h diff --git a/palacios/include/devices/nvram.h b/palacios/include/devices/nvram.h new file mode 100644 index 0000000..9d18027 --- /dev/null +++ b/palacios/include/devices/nvram.h @@ -0,0 +1,10 @@ +#ifndef _nvram +#define _nvram + +#include + + + +struct vm_device *nvram_create(); + +#endif diff --git a/palacios/include/palacios/vm_guest.h b/palacios/include/palacios/vm_guest.h index 977356d..d271972 100644 --- a/palacios/include/palacios/vm_guest.h +++ b/palacios/include/palacios/vm_guest.h @@ -6,6 +6,7 @@ #include #include #include +#include typedef ullong_t gpr_t; @@ -57,6 +58,8 @@ struct guest_info { vmm_io_map_t io_map; // device_map + struct vmm_dev_mgr dev_mgr; + vm_cpu_mode_t cpu_mode; diff --git a/palacios/include/palacios/vmm_dev.h b/palacios/include/palacios/vmm_dev.h index 29f8a24..3b67c61 100644 --- a/palacios/include/palacios/vmm_dev.h +++ b/palacios/include/palacios/vmm_dev.h @@ -1,16 +1,97 @@ #ifndef __VMM_DEV_H #define __VMM_DEV_H +#include + +struct vm_guest; +struct vm_device_io_hook; +struct vm_device_mem_hook; + + +// +// This structure defines an abstract io and/or memory-mapped device +// It currently does not define the interaction with actual hardware +// + struct vm_device { - int (*init_device + int (*init_device)(struct vm_device *dev, struct vm_guest *vm); + int (*deinit_device)(struct vm_device *dev); -}; + int (*reset_device)(struct vm_device *dev); + + int (*start_device)(struct vm_device *dev); + int (*stop_device)(struct vm_device *dev); + + + // + // To understand how to register these callbacks + // see vmm_dev_mgr.h + // + // Note that callbacks like these are only called + // when the port/memory is hooked as EMULATED + // + + + // + // If your device is I/O mapped, this function will + // be called on an I/O read + // + + int (*read_io_port)(ushort_t port_read, + void *address, + uint_t length, + struct vm_device *dev); + + // + // If your device is I/O mapped, this function will + // be called on an I/O write + // + int (*write_io_port)(ushort_t port_written, + void *address, + uint_t length, + struct vm_device *dev); + // + // If your device is memory mapped, this function will + // be called on an memory read + // + + int (*read_mapped_memory)(void *address_read, + void *address, + uint_t length, + struct vm_device *dev); + + // + // If your device is memory mapped, this function will + // be called on an memory read + // + + int (*write_mapped_memory)(void *address_written, + void *address, + uint_t length, + struct vm_device *dev); + + + //int (*save_device)(struct vm_device *dev, struct *iostream); + //int (*restore_device)(struct vm_device *dev, struct *iostream); + + struct guest_info *vm; + + void *private_data; + + // Do not touch anything below this! + + struct vm_device *next, *prev; + + struct vm_device_io_hook *io_hooks; + struct vm_device_mem_hook *mem_hooks; + +}; #endif diff --git a/palacios/include/palacios/vmm_dev_mgr.h b/palacios/include/palacios/vmm_dev_mgr.h new file mode 100644 index 0000000..5f1e96e --- /dev/null +++ b/palacios/include/palacios/vmm_dev_mgr.h @@ -0,0 +1,93 @@ +#ifndef _vmm_dev_mgr +#define _vmm_dev_mgr + +#include +#include + +struct vm_device; +struct guest_info; + + +struct vmm_dev_mgr { + struct guest_info *vm; + struct vm_device *dev_list; + uint_t num_devices; +}; + + +enum access_control {DEVICE_EMULATED, DEVICE_PASSTHROUGH} ; +enum access_type {DEVICE_READ, DEVICE_WRITE, DEVICE_READWRITE} ; + +struct vm_device_io_hook { + enum access_control control; + enum access_type atype; + + ushort_t guest_port; + + // Do not touch anything below this + + struct vm_device_io_hook *next, *prev; +}; + +struct vm_device_mem_hook { + enum access_control control; + enum access_type atype; + + void *guest_physical_start; + void *guest_physical_end; + + // Do not touch anything below this + + struct vm_device_mem_hook *next, *prev; + +}; + + + +// Registration of devices + +// +// The following device manager functions should only be called +// when the guest is stopped +// + +int dev_mgr_init(struct vmm_dev_mgr *mgr, struct guest_info *vm); +int dev_mgr_deinit(struct vmm_dev_mgr *mgr); + +int dev_mgr_attach_device(struct guest_info *vm, + struct vm_device *device); +int dev_mgr_detach_device(struct guest_info *vm, + struct vm_device *device); + + +int dev_mgr_hook_io(struct guest_info *vm, + struct vm_device *device, + ushort_t portno, + enum access_control control, + enum access_type atype); + +int dev_mgr_unhook_io(struct guest_info *vm, + struct vm_device *device, + ushort_t portno); + +int dev_mgr_hook_mem(struct guest_info *vm, + struct vm_device *device, + void *guest_physical_address_start, + void *guest_physical_address_end, + enum access_control control, + enum access_type atype); + +int dev_mgr_unhook_mem(struct guest_info *vm, + struct vm_device *device, + void *guest_physical_address_start, + void *guest_physical_address_end); + +// +// Strictly a helper - the device is resposible for unhooking on disconnect +// + +int dev_mgr_unhook_device(struct guest_info *vm, + struct vm_device *device); + + +#endif diff --git a/palacios/include/palacios/vmm_device_types.h b/palacios/include/palacios/vmm_device_types.h new file mode 100644 index 0000000..0d41133 --- /dev/null +++ b/palacios/include/palacios/vmm_device_types.h @@ -0,0 +1,12 @@ +#ifndef _vmm_device_types +#define _vmm_device_types + + + +enum vmm_device_type { + VMM_DEVICE_PIC, + VMM_DEVICE_APIC, + VMM_DEVICE_NVRAM +}; + +#endif diff --git a/palacios/src/devices/nvram.c b/palacios/src/devices/nvram.c new file mode 100644 index 0000000..fb5b9eb --- /dev/null +++ b/palacios/src/devices/nvram.c @@ -0,0 +1,202 @@ +#include +#include +#include + +extern struct vmm_os_hooks *os_hooks; + + +#define NVRAM_REG_PORT 0x70 +#define NVRAM_DATA_PORT 0x71 + + + +typedef enum {NVRAM_READY,NVRAM_REG_POSTED} nvram_state_t; + + +#define NVRAM_REG_MAX 256 + + +// These are borrowed from Bochs, which borrowed from +// Ralf Brown's interupt list +#define NVRAM_REG_SEC 0x00 +#define NVRAM_REG_SEC_ALARM 0x01 +#define NVRAM_REG_MIN 0x02 +#define NVRAM_REG_MIN_ALARM 0x03 +#define NVRAM_REG_HOUR 0x04 +#define NVRAM_REG_HOUR_ALARM 0x05 +#define NVRAM_REG_WEEK_DAY 0x06 +#define NVRAM_REG_MONTH_DAY 0x07 +#define NVRAM_REG_MONTH 0x08 +#define NVRAM_REG_YEAR 0x09 +#define NVRAM_REG_STAT_A 0x0a +#define NVRAM_REG_STAT_B 0x0b +#define NVRAM_REG_STAT_C 0x0c +#define NVRAM_REG_STAT_D 0x0d +#define NVRAM_REG_DIAGNOSTIC_STATUS 0x0e +#define NVRAM_REG_SHUTDOWN_STATUS 0x0f +#define NVRAM_REG_EQUIPMENT_BYTE 0x14 +#define NVRAM_REG_CSUM_HIGH 0x2e +#define NVRAM_REG_CSUM_LOW 0x2f +#define NVRAM_REG_IBM_CENTURY_BYTE 0x32 +#define NVRAM_REG_IBM_PS2_CENTURY_BYTE 0x37 + + + +struct nvram_internal { + nvram_state_t dev_state; + uchar_t thereg; + uchar_t mem_state[NVRAM_REG_MAX]; +}; + + + + + +int nvram_reset_device(struct vm_device *dev) +{ + struct nvram_internal *data = (struct nvram_internal *) dev->private_data; + + data->dev_state = NVRAM_READY; + data->thereg=0; + + return 0; + +} + +int nvram_init_device(struct vm_device *dev, struct vm_guest *vm) +{ + struct nvram_internal *data = (struct nvram_internal *) dev->private_data; + + memset(data->mem_state,0,NVRAM_REG_MAX); + + nvram_reset_device(dev); + + // hook ports + dev_mgr_hook_io(dev->vm, + dev, + NVRAM_REG_PORT, + DEVICE_EMULATED, + DEVICE_WRITE); + + dev_mgr_hook_io(dev->vm, + dev, + NVRAM_DATA_PORT, + DEVICE_EMULATED, + DEVICE_READWRITE); + + return 0; +} + +int nvram_deinit_device(struct vm_device *dev) +{ + + nvram_reset_device(dev); + + dev_mgr_unhook_device(dev->vm,dev); + + return 0; +} + + + + + + +int nvram_start_device(struct vm_device *dev) +{ + return 0; +} + + +int nvram_stop_device(struct vm_device *dev) +{ + return 0; +} + + + +int nvram_read_io_port(ushort_t port_read, + void *address, + uint_t length, + struct vm_device *dev) +{ + struct nvram_internal *data = (struct nvram_internal *) dev->private_data; + + switch (port_read) { + case NVRAM_REG_PORT: + // nonsense + memset(address,0,length); + break; + case NVRAM_DATA_PORT: + memcpy(address,&(data->mem_state[data->thereg]),1); + break; + default: + //bad + return -1; + } + return 0; +} + +int nvram_write_io_port(ushort_t port_written, + void *address, + uint_t length, + struct vm_device *dev) +{ + struct nvram_internal *data = (struct nvram_internal *) dev->private_data; + + switch (port_written) { + case NVRAM_REG_PORT: + memcpy(&(data->thereg),address,1); + break; + case NVRAM_DATA_PORT: + memcpy(&(data->mem_state[data->thereg]),address,1); + break; + default: + //bad + return -1; + } + return 0; +} + +int nvram_read_mapped_memory(void *address_read, + void *address, + uint_t length, + struct vm_device *dev) +{ + return -1; + +} + +int nvram_write_mapped_memory(void *address_written, + void *address, + uint_t length, + struct vm_device *dev) +{ + return -1; +} + + +static struct vm_device nvram_template = + { .init_device = nvram_init_device, + .deinit_device = nvram_deinit_device, + .reset_device = nvram_reset_device, + .start_device = nvram_start_device, + .stop_device = nvram_stop_device, + .read_io_port = nvram_read_io_port, + .write_io_port = nvram_write_io_port, + .read_mapped_memory = nvram_read_mapped_memory, + .write_mapped_memory= nvram_write_mapped_memory, + }; + + + +struct vm_device *nvram_create() +{ + struct vm_device *device = os_hooks->malloc(sizeof(struct vm_device)); + + *device = nvram_template; + + device->private_data = os_hooks->malloc(sizeof(struct nvram_internal)); + + return device; +} diff --git a/palacios/src/geekos/main.c b/palacios/src/geekos/main.c index 1624aa9..a66c42f 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.32 $ + * $Revision: 1.33 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -179,7 +179,6 @@ void Main(struct Boot_Info* bootInfo) Init_BSS(); Init_Screen(); - Init_Serial(); Init_Mem(bootInfo); Init_CRC32(); diff --git a/palacios/src/palacios/vmm_dev.c b/palacios/src/palacios/vmm_dev.c new file mode 100644 index 0000000..0d095f8 --- /dev/null +++ b/palacios/src/palacios/vmm_dev.c @@ -0,0 +1 @@ +#include diff --git a/palacios/src/palacios/vmm_dev_mgr.c b/palacios/src/palacios/vmm_dev_mgr.c new file mode 100644 index 0000000..81f053c --- /dev/null +++ b/palacios/src/palacios/vmm_dev_mgr.c @@ -0,0 +1,295 @@ + +#include +#include +#include +#include + +extern struct vmm_os_hooks *os_hooks; + +#ifndef NULL +#define NULL 0 +#endif + +int dev_mgr_init(struct vmm_dev_mgr *mgr, struct guest_info *vm) +{ + mgr->vm=vm; + mgr->dev_list=NULL; + mgr->num_devices=0; + return 0; +} + + +int dev_mgr_deinit(struct vmm_dev_mgr *mgr) +{ + int rc; + + while (mgr->dev_list) { + rc=dev_mgr_detach_device(mgr->vm,mgr->dev_list); + if (rc) { + // Bad bad bad + } + } + return 0; +} + +int dev_mgr_attach_device(struct guest_info *vm, struct vm_device *device) +{ + struct vmm_dev_mgr *mgr= &(vm->dev_mgr); + + if (device->io_hooks || device->mem_hooks) { + return -1; + } + + device->next = mgr->dev_list; + device->prev = 0; + if (device->next) { + device->next->prev = device; + } + mgr->dev_list = device; + + device->vm=vm; + + return 0; +} + +int dev_mgr_detach_device(struct guest_info *vm, struct vm_device *device) +{ + if (device->prev==0) { + vm->dev_mgr.dev_list = device->next; + } else { + device->prev->next = device->next; + } + if (device->next) { + device->next->prev=device->prev; + } + + // avoid interrupts here + + device->deinit_device(device); + + device->vm=NULL; + return 0; +} + + +#define INSERT_FRONT(listhead,item) \ + do { \ + if (!(listhead)) { \ + (listhead)=(item); \ + (item)->prev=NULL; \ + (item)->next=NULL; \ + } else { \ + (item)->prev=NULL; \ + (item)->next=(listhead); \ + if ((listhead)->next) { \ + (listhead)->next->prev=(item); \ + } \ + (listhead)=(item); \ + } \ + } while (0) + +#define DELETE(listhead,item) \ + do { \ + if ((item)->prev) { \ + (item)->prev->next=(item)->next; \ + } else { \ + (listhead)=(item)->next; \ + } \ + if ((item)->next) { \ + (item)->next->prev=(item)->prev; \ + } \ + } while (0) + + + + +int dev_mgr_hook_io(struct guest_info *vm, + struct vm_device *device, + ushort_t portno, + enum access_control control, + enum access_type atype) +{ + struct vm_device_io_hook *hook = os_hooks->malloc(sizeof(struct vm_device_io_hook)); + + if (!hook) { + return -1; + } + + int (*read)(ushort_t, void *, uint_t, void *) = NULL; + int (*write)(ushort_t, void *, uint_t, void *) = NULL; + + switch (control) { + case DEVICE_EMULATED: + switch (atype) { + case DEVICE_READ: + read = (int (*)(ushort_t, void *,uint_t, void *)) (device->read_io_port); + break; + case DEVICE_WRITE: + write = (int (*)(ushort_t, void *, uint_t, void *)) (device->write_io_port); + break; + case DEVICE_READWRITE: + read = (int (*)(ushort_t, void *, uint_t, void *)) (device->read_io_port); + write = (int (*)(ushort_t, void *, uint_t, void *)) (device->write_io_port); + break; + } + break; + case DEVICE_PASSTHROUGH: + read=write=NULL; + break; + } + + hook_io_port(&(vm->io_map), + portno, + read, + write, + device); + + hook->control=control; + hook->atype=atype; + hook->guest_port = portno; + + INSERT_FRONT(device->io_hooks,hook); + + return 0; +} + + +int dev_mgr_unhook_io(struct guest_info *vm, + struct vm_device *device, + ushort_t portno) +{ + struct vm_device_io_hook *hook = device->io_hooks; + + while (hook) { + if (hook->guest_port==portno) { + DELETE(device->io_hooks,hook); + break; + } + } + + if (!hook) { + // Very bad - unhooking something that doesn't exist! + return -1; + } + + return unhook_io_port(&(vm->io_map), + portno); +} + + + +int dev_mgr_hook_mem(struct guest_info *vm, + struct vm_device *device, + void *guest_physical_address_start, + void *guest_physical_address_end, + enum access_control control, + enum access_type atype) +{ + + struct vm_device_mem_hook *hook = os_hooks->malloc(sizeof(struct vm_device_mem_hook)); + + if (!hook) { + return -1; + } + + int (*read)(ushort_t, void *, uint_t, void *) = NULL; + int (*write)(ushort_t, void *, uint_t, void *) = NULL; + + switch (control) { + case DEVICE_EMULATED: + switch (atype) { + case DEVICE_READ: + read = (int (*)(ushort_t, void *, uint_t, void *))(device->read_mapped_memory); + break; + case DEVICE_WRITE: + write = (int (*)(ushort_t, void *, uint_t, void *))(device->write_mapped_memory); + break; + case DEVICE_READWRITE: + read = (int (*)(ushort_t, void *, uint_t, void *))(device->read_mapped_memory); + write = (int (*)(ushort_t, void *, uint_t, void *))(device->write_mapped_memory); + break; + } + break; + case DEVICE_PASSTHROUGH: + read=write=NULL; + break; + } + + + /* not implemented yet + hook_memory(vm->mem_map, + guest_physical_address_start, + guest_physical_address_end, + read, + write, + device); + + */ + + return -1; // remove when hook_memory works + + hook->control=control; + hook->atype=atype; + hook->guest_physical_start = guest_physical_address_start; + hook->guest_physical_end = guest_physical_address_end; + + + INSERT_FRONT(device->mem_hooks,hook); + + return 0; + +} + + +int dev_mgr_unhook_mem(struct guest_info *vm, + struct vm_device *device, + void *guest_physical_start, + void *guest_physical_end) +{ + struct vm_device_mem_hook *hook = device->mem_hooks; + + while (hook) { + if (hook->guest_physical_start==guest_physical_start && + hook->guest_physical_end==guest_physical_end) { + DELETE(device->mem_hooks,hook); + break; + } + } + + if (!hook) { + // Very bad - unhooking something that doesn't exist! + return -1; + } + + + /* not implemented yet + return unhook_mem_port(vm->mem_map, + guest_physical_start, + guest_physical_end) ; + + */ + return -1; +} + + +int dev_mgr_unhook_device(struct guest_info *vm, + struct vm_device *device) +{ + struct vm_device_io_hook *iohook=device->io_hooks; + struct vm_device_mem_hook *memhook=device->mem_hooks; + + while (iohook) { + if (dev_mgr_unhook_io(vm,device,iohook->guest_port)) { + return -1; + } + } + + while (memhook) { + if (dev_mgr_unhook_mem(vm,device,memhook->guest_physical_start, memhook->guest_physical_end)) { + return -1; + } + } + + return 0; +} +