Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


added full device support
Jack Lange [Mon, 14 Apr 2008 06:12:24 +0000 (06:12 +0000)]
17 files changed:
palacios/build/Makefile
palacios/build/depend.mak
palacios/include/devices/nvram.h
palacios/include/palacios/vm_dev.h [new file with mode: 0644]
palacios/include/palacios/vmm.h
palacios/include/palacios/vmm_dev_mgr.h
palacios/include/palacios/vmm_io.h
palacios/include/palacios/vmm_list.h [new file with mode: 0644]
palacios/scripts/make_payload.pl [new file with mode: 0755]
palacios/src/devices/README [new file with mode: 0644]
palacios/src/devices/nvram.c
palacios/src/geekos/vm.c
palacios/src/palacios/svm.c
palacios/src/palacios/svm_handler.c
palacios/src/palacios/vm_dev.c [new file with mode: 0644]
palacios/src/palacios/vmm_dev_mgr.c
palacios/src/palacios/vmm_io.c

index 4b69f38..95b2af2 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile for GeekOS kernel, userspace, and tools
 # Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
-# $Revision: 1.24 $
+# $Revision: 1.25 $
 
 # This is free software.  You are permitted to use,
 # redistribute, and modify it as specified in the file "COPYING".
@@ -126,7 +126,7 @@ VMM_C_SRCS :=   vm_guest.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_dev.c vmm_dev_mgr.c \
+                vm_dev.c vmm_dev_mgr.c \
 #\
 #              vmx.c vmcs_gen.c vmcs.c
 
@@ -138,7 +138,7 @@ DEVICE_C_SRCS :=  nvram.c
 
 DEVICE_C_OBJS := $(DEVICE_C_SRCS:%.c=devices/%.o)
 
-DEVICE_OBJS := $(DEVICE_C_OBJS) $(VMM_ASM_OBJS)
+DEVICE_OBJS := $(DEVICE_C_OBJS)
 
 
 
@@ -259,10 +259,10 @@ 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
+       $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_VMM_OPTS) $< -o devices/$*.o
 
 devices/%.o : devices/%.asm
-       $(NASM) $(NASM_VMM_OPTS) $< -o palacios/$*.o
+       $(NASM) $(NASM_VMM_OPTS) $< -o devices/$*.o
 
 # ----------------------------------------------------------------------
 # Targets -
@@ -326,7 +326,7 @@ geekos/kernel.bin : geekos/kernel.exe
 # The kernel executable and symbol map.
 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)
+               $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) $(DEVICE_OBJS)
        $(TARGET_NM) geekos/kernel.exe > geekos/kernel.syms
 
 
index 08b1c02..accf30e 100644 (file)
@@ -1,55 +1,55 @@
 geekos/idt.o: ../src/geekos/idt.c ../include/geekos/kassert.h \
   ../include/geekos/screen.h ../include/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/debug.h
 geekos/irq.o: ../src/geekos/irq.c ../include/geekos/kassert.h \
   ../include/geekos/screen.h ../include/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
   ../include/geekos/string.h ../include/geekos/../libc/string.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
@@ -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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
@@ -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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/fmtout.h \
   ../include/geekos/../libc/fmtout.h \
-  /home/pdinda/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/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/pdinda/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/stdarg.h \
   ../include/geekos/kassert.h ../include/geekos/screen.h \
   ../include/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
 geekos/timer.o: ../src/geekos/timer.c \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/limits.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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/fmtout.h ../include/geekos/../libc/fmtout.h \
-  /home/pdinda/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/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/fmtout.h ../include/geekos/../libc/fmtout.h \
-  /home/pdinda/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/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
   ../include/geekos/debug.h
 geekos/segment.o: ../src/geekos/segment.c ../include/geekos/kassert.h \
   ../include/geekos/screen.h ../include/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdarg.h \
   ../include/geekos/string.h ../include/geekos/../libc/string.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/fmtout.h \
   ../include/geekos/../libc/fmtout.h \
-  /home/pdinda/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/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 ../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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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,54 +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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/vmm_stubs.o: ../src/geekos/vmm_stubs.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 \
+  /home/jarusl/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 \
+  /home/jarusl/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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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/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 \
+  /home/jarusl/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 \
+  /home/jarusl/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 \
+  /home/jarusl/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
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.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/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.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 \
+  /home/jarusl/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 \
@@ -297,211 +297,194 @@ geekos/main.o: ../src/geekos/main.c ../include/geekos/bootinfo.h \
   ../include/geekos/debug.h ../include/geekos/vm.h \
   ../include/geekos/gdt.h
 common/fmtout.o: ../src/common/fmtout.c \
-  /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 \
+  /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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/limits.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 \
-  /home/pdinda/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/stdarg.h \
   ../include/libc/string.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/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 \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
+  /home/jarusl/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 \
+  /home/jarusl/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/vmm_device_types.h ../include/palacios/vmm_list.h \
+  ../include/palacios/vmm_string.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h
 palacios/svm.o: ../src/palacios/svm.c ../include/palacios/svm.h \
   ../include/palacios/vmm_util.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 \
+  /home/jarusl/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 \
+  /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_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/svm_handler.h ../include/palacios/vmm_debug.h \
-  ../include/palacios/vm_guest_mem.h
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.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/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/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 \
+  /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_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/vm_guest_mem.h ../include/palacios/vmm_emulate.h \
-  ../include/palacios/svm_ctrl_regs.h ../include/palacios/svm_io.h
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.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_string.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+  /home/jarusl/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 \
+  /home/jarusl/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
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.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/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/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 \
+  /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_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/vmm_device_types.h ../include/palacios/vmm_list.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 \
+  /home/jarusl/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/vmm.h \
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.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
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+  ../include/palacios/vmm.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/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/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 \
+  /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_intr.h \
   ../include/palacios/vmm_dev_mgr.h \
-  ../include/palacios/vmm_device_types.h
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.h
 palacios/vmm_mem.o: ../src/palacios/vmm_mem.c ../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 \
+  /home/jarusl/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 \
+  /home/jarusl/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_intr.h \
   ../include/palacios/vmm_dev_mgr.h \
-  ../include/palacios/vmm_device_types.h
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.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 \
+  /home/jarusl/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/palacios/vmm_string.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+  /home/jarusl/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_intr.h \
   ../include/palacios/vmm_dev_mgr.h \
-  ../include/palacios/vmm_device_types.h \
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.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/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/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 \
+  /home/jarusl/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_intr.h \
   ../include/palacios/vmm_dev_mgr.h \
-  ../include/palacios/vmm_device_types.h
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.h
 palacios/vmm_debug.o: ../src/palacios/vmm_debug.c ../include/palacios/vmm_debug.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 \
+  /home/jarusl/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 \
+  /home/jarusl/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/vmm_device_types.h ../include/palacios/vmm_list.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/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/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_device_types.h ../include/palacios/vmm_list.h \
+  ../include/palacios/vmm_string.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+  ../include/palacios/vmcb.h ../include/palacios/vmm.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 \
+  /home/jarusl/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
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.h \
+  ../include/palacios/vmm_string.h \
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.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/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/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 \
+  /home/jarusl/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/vmm_device_types.h ../include/palacios/vmm_list.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/geekos/ktypes.h \
-  /home/pdinda/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stdbool.h \
+  /home/jarusl/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/vmm.h \
+  ../include/palacios/vmm_device_types.h ../include/palacios/vmm_list.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_intr.h \
-  ../include/palacios/vmm_dev_mgr.h \
-  ../include/palacios/vmm_device_types.h
+  /home/jarusl/vmm-dev/devtools/i386/lib/gcc/i386-elf/3.4.6/include/stddef.h \
+  ../include/palacios/vmm.h
index 9d18027..3bf96d5 100644 (file)
@@ -1,10 +1,10 @@
-#ifndef _nvram
-#define _nvram
+#ifndef __NVRAM_H
+#define __NVRAM_H
 
-#include <palacios/vmm_dev.h>
+#include <palacios/vm_dev.h>
 
 
 
-struct vm_device *nvram_create();
+struct vm_device * nvram_create();
 
 #endif
diff --git a/palacios/include/palacios/vm_dev.h b/palacios/include/palacios/vm_dev.h
new file mode 100644 (file)
index 0000000..192a2b5
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef __VM_DEV_H
+#define __VM_DEV_H
+
+#include <palacios/vmm_types.h>
+#include <palacios/vmm_list.h>
+#include <palacios/vmm_dev_mgr.h>
+
+struct guest_info;
+
+
+struct vm_device;
+
+
+struct vm_device_ops {
+  int (*init)(struct vm_device *dev);
+  int (*deinit)(struct vm_device *dev);
+
+
+  int (*reset)(struct vm_device *dev);
+
+  int (*start)(struct vm_device *dev);
+  int (*stop)(struct vm_device *dev);
+
+
+  //int (*save)(struct vm_device *dev, struct *iostream);
+  //int (*restore)(struct vm_device *dev, struct *iostream);
+};
+
+
+
+struct vm_device {
+  char name[32];
+  
+  void *private_data;
+
+  struct vm_device_ops * ops;
+
+  struct guest_info * vm;
+
+  struct vm_device   *next, *prev;
+
+
+  struct dev_io_hook_list io_hooks;
+  struct dev_mem_hook_list mem_hooks;
+};
+
+
+
+struct vm_device * allocate_device();
+struct vm_device * create_device(char * name, struct vm_device_ops * ops, void * private_data);
+void free_device(struct vm_device * dev);
+
+
+
+int dev_hook_io(struct vm_device   *dev,
+               ushort_t            port,
+               int (*read)(ushort_t port, void * dst, uint_t length, struct vm_device * dev),
+               int (*write)(ushort_t port, void * src, uint_t length, struct vm_device * dev));
+
+int dev_unhook_io(struct vm_device   *dev,
+                 ushort_t            port);
+
+int dev_hook_mem(struct vm_device   *dev,
+                void               *start,
+                void               *end);
+
+int dev_unhook_mem(struct vm_device   * dev,
+                  void               * start,
+                  void               * end);
+
+
+
+
+
+#endif
index d81f4b6..746faba 100644 (file)
 
 
 /* This clearly won't work, we need some way to get a return value out of it */
-#define VMMMalloc(size)                                 \
+#define VMMMalloc(type, var, size)                     \
   do {                                                 \
     extern struct vmm_os_hooks * os_hooks;             \
     if ((os_hooks) && (os_hooks)->malloc) {            \
-      (os_hooks)->malloc(size);                                \
+      var = (type)(os_hooks)->malloc(size);            \
     }                                                  \
   } while (0)                                          \
 
 
 
 
-
-
-
-/* We need a memory map and an IO device map */
-
 /* This will contain function pointers that provide OS services */
 struct vmm_os_hooks {
   void (*print_info)(const char * format, ...);
@@ -90,13 +85,14 @@ struct vmm_os_hooks {
   void *(*paddr_to_vaddr)(void *addr);
   void *(*vaddr_to_paddr)(void *addr);
 
+  // Do we need this here?
+  void (*snprintf)(char * dst, char * format, int len, ...);
 
   void (*start_kernel_thread)(); // include pointer to function
 };
 
 
 
-
 /* This will contain Function pointers that control the VMs */
 struct vmm_ctrl_ops {
   int (*init_guest)(struct guest_info* info);
@@ -108,8 +104,6 @@ struct vmm_ctrl_ops {
 
 
 
-
-
 void Init_VMM(struct vmm_os_hooks * hooks, struct vmm_ctrl_ops * vmm_ops);
 
 
index 5f1e96e..6ea56df 100644 (file)
@@ -1,45 +1,62 @@
-#ifndef _vmm_dev_mgr
-#define _vmm_dev_mgr
+#ifndef _VMM_DEV_MGR
+#define _VMM_DEV_MGR
 
 #include <palacios/vmm_types.h>
 #include <palacios/vmm_device_types.h>
+#include <palacios/vmm_list.h>
+#include <palacios/vmm_string.h>
+
 
 struct vm_device;
 struct guest_info;
 
+struct vm_dev_list {
+  struct vm_device * head;
+  uint_t num_devs;
+};
 
-struct vmm_dev_mgr {
-  struct guest_info   *vm;
-  struct vm_device  *dev_list;
-  uint_t             num_devices;
+
+struct dev_io_hook_list {
+  struct dev_io_hook * head;
+  uint_t num_hooks;
 };
 
 
-enum access_control {DEVICE_EMULATED, DEVICE_PASSTHROUGH} ;
-enum access_type {DEVICE_READ, DEVICE_WRITE, DEVICE_READWRITE} ;
+struct dev_mem_hook_list {
+  struct dev_mem_hook * head;
+  uint_t num_hooks;
+};
 
-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 vmm_dev_mgr {
+  struct vm_dev_list dev_list;
+  struct dev_io_hook_list io_hooks;
+  struct dev_mem_hook_list mem_hooks;
 };
 
-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 dev_io_hook {
+  ushort_t port;
   
-  struct vm_device_mem_hook *next, *prev;
+  int (*read)(ushort_t port, void * dst, uint_t length, struct vm_device * dev);
+  int (*write)(ushort_t port, void * src, uint_t length, struct vm_device * dev);
 
+  struct vm_device * dev;
+
+  // Do not touch anything below this  
+  struct dev_io_hook *dev_next, *dev_prev;
+  struct dev_io_hook *mgr_next, *mgr_prev;
+};
+
+struct dev_mem_hook {
+  void             *addr_start;
+  void             *addr_end;
+
+  // Do not touch anything below this
+  struct dev_mem_hook *dev_next, *dev_prev;
+  struct dev_mem_hook *mgr_next, *mgr_prev;
 };
 
 
@@ -51,43 +68,22 @@ struct vm_device_mem_hook {
 // 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_init(struct vmm_dev_mgr *mgr);
+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 attach_device(struct guest_info *vm, struct vm_device * dev);
+int unattach_device(struct vm_device *dev);
 
-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_add_device(struct vmm_dev_mgr * mgr, struct vm_device * dev);
+int dev_mgr_remove_device(struct vmm_dev_mgr * mgr, struct vm_device * dev);
 
-int dev_mgr_unhook_device(struct guest_info  *vm,
-                         struct vm_device *device);
 
+void PrintDebugDevMgr(struct vmm_dev_mgr * mgr);
+void PrintDebugDev(struct vm_device * dev);
+void PrintDebugDevIO(struct vm_device * dev);
+void PrintDebugDevMgrIO(struct vmm_dev_mgr * mgr);
 
 #endif
index 14c2e76..34c04f0 100644 (file)
@@ -35,18 +35,18 @@ typedef struct vmm_io_map {
 } vmm_io_map_t;
 
 
-void add_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook);
+int add_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook);
 
-void remove_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook);
+int remove_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook);
 
 vmm_io_hook_t * get_io_hook(vmm_io_map_t * io_map, uint_t port);
 
 
 /* External API */
-void hook_io_port(vmm_io_map_t * io_map, uint_t port, 
+int hook_io_port(vmm_io_map_t * io_map, uint_t port, 
                  int (*read)(ushort_t port, void * dst, uint_t length, void * priv_data),
                  int (*write)(ushort_t port, void * src, uint_t length, void * priv_data), 
-                 void * priv_data );
+                 void * priv_data);
 
 int unhook_io_port(vmm_io_map_t * io_map, uint_t port);
 
@@ -55,4 +55,8 @@ void init_vmm_io_map(vmm_io_map_t * io_map);
 void PrintDebugIOMap(vmm_io_map_t * io_map);
 
 
+
+
+
+
 #endif
diff --git a/palacios/include/palacios/vmm_list.h b/palacios/include/palacios/vmm_list.h
new file mode 100644 (file)
index 0000000..9fcf799
--- /dev/null
@@ -0,0 +1,522 @@
+#ifndef _VMM_LIST_H
+#define _VMM_LIST_H
+
+#include <palacios/vmm_string.h>
+
+#undef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+
+static inline void prefetch(const void *x) {;}
+
+/*
+ * These are non-NULL pointers that will result in page faults
+ * under normal circumstances, used to verify that nobody uses
+ * non-initialized list entries.
+ */
+#define LIST_POISON1  ((void *) 0x00100100)
+#define LIST_POISON2  ((void *) 0x00200200)
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+
+struct list_head {
+       struct list_head *next, *prev;
+};
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+       struct list_head name = LIST_HEAD_INIT(name)
+
+static inline void INIT_LIST_HEAD(struct list_head *list)
+{
+       list->next = list;
+       list->prev = list;
+}
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_add(struct list_head *new,
+                             struct list_head *prev,
+                             struct list_head *next)
+{
+       next->prev = new;
+       new->next = next;
+       new->prev = prev;
+       prev->next = new;
+}
+
+/**
+ * list_add - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+static inline void list_add(struct list_head *new, struct list_head *head)
+{
+       __list_add(new, head, head->next);
+}
+
+/**
+ * list_add_tail - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ */
+static inline void list_add_tail(struct list_head *new, struct list_head *head)
+{
+       __list_add(new, head->prev, head);
+}
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_del(struct list_head * prev, struct list_head * next)
+{
+       next->prev = prev;
+       prev->next = next;
+}
+
+/**
+ * list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ * Note: list_empty on entry does not return true after this, the entry is
+ * in an undefined state.
+ */
+static inline void list_del(struct list_head *entry)
+{
+       __list_del(entry->prev, entry->next);
+       entry->next = LIST_POISON1;
+       entry->prev = LIST_POISON2;
+}
+
+/**
+ * list_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.
+ */
+static inline void list_del_init(struct list_head *entry)
+{
+       __list_del(entry->prev, entry->next);
+       INIT_LIST_HEAD(entry);
+}
+
+/**
+ * list_move - delete from one list and add as another's head
+ * @list: the entry to move
+ * @head: the head that will precede our entry
+ */
+static inline void list_move(struct list_head *list, struct list_head *head)
+{
+        __list_del(list->prev, list->next);
+        list_add(list, head);
+}
+
+/**
+ * list_move_tail - delete from one list and add as another's tail
+ * @list: the entry to move
+ * @head: the head that will follow our entry
+ */
+static inline void list_move_tail(struct list_head *list,
+                                 struct list_head *head)
+{
+        __list_del(list->prev, list->next);
+        list_add_tail(list, head);
+}
+
+/**
+ * list_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+static inline int list_empty(const struct list_head *head)
+{
+       return head->next == head;
+}
+
+/**
+ * list_empty_careful - tests whether a list is
+ * empty _and_ checks that no other CPU might be
+ * in the process of still modifying either member
+ *
+ * NOTE: using list_empty_careful() without synchronization
+ * can only be safe if the only activity that can happen
+ * to the list entry is list_del_init(). Eg. it cannot be used
+ * if another CPU could re-list_add() it.
+ *
+ * @head: the list to test.
+ */
+static inline int list_empty_careful(const struct list_head *head)
+{
+       struct list_head *next = head->next;
+       return (next == head) && (next == head->prev);
+}
+
+static inline void __list_splice(struct list_head *list,
+                                struct list_head *head)
+{
+       struct list_head *first = list->next;
+       struct list_head *last = list->prev;
+       struct list_head *at = head->next;
+
+       first->prev = head;
+       head->next = first;
+
+       last->next = at;
+       at->prev = last;
+}
+
+/**
+ * list_splice - join two lists
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static inline void list_splice(struct list_head *list, struct list_head *head)
+{
+       if (!list_empty(list))
+               __list_splice(list, head);
+}
+
+/**
+ * list_splice_init - join two lists and reinitialise the emptied list.
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * The list at @list is reinitialised
+ */
+static inline void list_splice_init(struct list_head *list,
+                                   struct list_head *head)
+{
+       if (!list_empty(list)) {
+               __list_splice(list, head);
+               INIT_LIST_HEAD(list);
+       }
+}
+
+/**
+ * list_entry - get the struct for this entry
+ * @ptr:       the &struct list_head pointer.
+ * @type:      the type of the struct this is embedded in.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+       container_of(ptr, type, member)
+
+/**
+ * list_for_each       -       iterate over a list
+ * @pos:       the &struct list_head to use as a loop counter.
+ * @head:      the head for your list.
+ */
+#define list_for_each(pos, head) \
+       for (pos = (head)->next; prefetch(pos->next), pos != (head); \
+               pos = pos->next)
+
+/**
+ * __list_for_each     -       iterate over a list
+ * @pos:       the &struct list_head to use as a loop counter.
+ * @head:      the head for your list.
+ *
+ * This variant differs from list_for_each() in that it's the
+ * simplest possible list iteration code, no prefetching is done.
+ * Use this for code that knows the list to be very short (empty
+ * or 1 entry) most of the time.
+ */
+#define __list_for_each(pos, head) \
+       for (pos = (head)->next; pos != (head); pos = pos->next)
+
+/**
+ * list_for_each_prev  -       iterate over a list backwards
+ * @pos:       the &struct list_head to use as a loop counter.
+ * @head:      the head for your list.
+ */
+#define list_for_each_prev(pos, head) \
+       for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
+               pos = pos->prev)
+
+/**
+ * list_for_each_safe  -       iterate over a list safe against removal of list entry
+ * @pos:       the &struct list_head to use as a loop counter.
+ * @n:         another &struct list_head to use as temporary storage
+ * @head:      the head for your list.
+ */
+#define list_for_each_safe(pos, n, head) \
+       for (pos = (head)->next, n = pos->next; pos != (head); \
+               pos = n, n = pos->next)
+
+/**
+ * list_for_each_entry -       iterate over list of given type
+ * @pos:       the type * to use as a loop counter.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry(pos, head, member)                         \
+       for (pos = list_entry((head)->next, typeof(*pos), member);      \
+            prefetch(pos->member.next), &pos->member != (head);        \
+            pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_reverse - iterate backwards over list of given type.
+ * @pos:       the type * to use as a loop counter.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_reverse(pos, head, member)                 \
+       for (pos = list_entry((head)->prev, typeof(*pos), member);      \
+            prefetch(pos->member.prev), &pos->member != (head);        \
+            pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
+ * list_prepare_entry - prepare a pos entry for use as a start point in
+ *                     list_for_each_entry_continue
+ * @pos:       the type * to use as a start point
+ * @head:      the head of the list
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_prepare_entry(pos, head, member) \
+       ((pos) ? : list_entry(head, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_continue -      iterate over list of given type
+ *                     continuing after existing point
+ * @pos:       the type * to use as a loop counter.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_continue(pos, head, member)                \
+       for (pos = list_entry(pos->member.next, typeof(*pos), member);  \
+            prefetch(pos->member.next), &pos->member != (head);        \
+            pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_from -  iterate over list of given type
+ *                     continuing from existing point
+ * @pos:       the type * to use as a loop counter.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_from(pos, head, member)                    \
+       for (; prefetch(pos->member.next), &pos->member != (head);      \
+            pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @pos:       the type * to use as a loop counter.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member)                 \
+       for (pos = list_entry((head)->next, typeof(*pos), member),      \
+               n = list_entry(pos->member.next, typeof(*pos), member); \
+            &pos->member != (head);                                    \
+            pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_continue - iterate over list of given type
+ *                     continuing after existing point safe against removal of list entry
+ * @pos:       the type * to use as a loop counter.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe_continue(pos, n, head, member)                \
+       for (pos = list_entry(pos->member.next, typeof(*pos), member),          \
+               n = list_entry(pos->member.next, typeof(*pos), member);         \
+            &pos->member != (head);                                            \
+            pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_from - iterate over list of given type
+ *                     from existing point safe against removal of list entry
+ * @pos:       the type * to use as a loop counter.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe_from(pos, n, head, member)                    \
+       for (n = list_entry(pos->member.next, typeof(*pos), member);            \
+            &pos->member != (head);                                            \
+            pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against
+ *                                   removal of list entry
+ * @pos:       the type * to use as a loop counter.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe_reverse(pos, n, head, member)         \
+       for (pos = list_entry((head)->prev, typeof(*pos), member),      \
+               n = list_entry(pos->member.prev, typeof(*pos), member); \
+            &pos->member != (head);                                    \
+            pos = n, n = list_entry(n->member.prev, typeof(*n), member))
+
+/*
+ * Double linked lists with a single pointer list head.
+ * Mostly useful for hash tables where the two pointer list head is
+ * too wasteful.
+ * You lose the ability to access the tail in O(1).
+ */
+
+struct hlist_head {
+       struct hlist_node *first;
+};
+
+struct hlist_node {
+       struct hlist_node *next, **pprev;
+};
+
+#define HLIST_HEAD_INIT { .first = NULL }
+#define HLIST_HEAD(name) struct hlist_head name = {  .first = NULL }
+#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
+static inline void INIT_HLIST_NODE(struct hlist_node *h)
+{
+       h->next = NULL;
+       h->pprev = NULL;
+}
+
+static inline int hlist_unhashed(const struct hlist_node *h)
+{
+       return !h->pprev;
+}
+
+static inline int hlist_empty(const struct hlist_head *h)
+{
+       return !h->first;
+}
+
+static inline void __hlist_del(struct hlist_node *n)
+{
+       struct hlist_node *next = n->next;
+       struct hlist_node **pprev = n->pprev;
+       *pprev = next;
+       if (next)
+               next->pprev = pprev;
+}
+
+static inline void hlist_del(struct hlist_node *n)
+{
+       __hlist_del(n);
+       n->next = LIST_POISON1;
+       n->pprev = LIST_POISON2;
+}
+
+static inline void hlist_del_init(struct hlist_node *n)
+{
+       if (!hlist_unhashed(n)) {
+               __hlist_del(n);
+               INIT_HLIST_NODE(n);
+       }
+}
+
+static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
+{
+       struct hlist_node *first = h->first;
+       n->next = first;
+       if (first)
+               first->pprev = &n->next;
+       h->first = n;
+       n->pprev = &h->first;
+}
+
+/* next must be != NULL */
+static inline void hlist_add_before(struct hlist_node *n,
+                                       struct hlist_node *next)
+{
+       n->pprev = next->pprev;
+       n->next = next;
+       next->pprev = &n->next;
+       *(n->pprev) = n;
+}
+
+static inline void hlist_add_after(struct hlist_node *n,
+                                       struct hlist_node *next)
+{
+       next->next = n->next;
+       n->next = next;
+       next->pprev = &n->next;
+
+       if(next->next)
+               next->next->pprev  = &next->next;
+}
+
+#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
+
+#define hlist_for_each(pos, head) \
+       for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
+            pos = pos->next)
+
+#define hlist_for_each_safe(pos, n, head) \
+       for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
+            pos = n)
+
+/**
+ * hlist_for_each_entry        - iterate over list of given type
+ * @tpos:      the type * to use as a loop counter.
+ * @pos:       the &struct hlist_node to use as a loop counter.
+ * @head:      the head for your list.
+ * @member:    the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry(tpos, pos, head, member)                   \
+       for (pos = (head)->first;                                        \
+            pos && ({ prefetch(pos->next); 1;}) &&                      \
+               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+            pos = pos->next)
+
+/**
+ * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point
+ * @tpos:      the type * to use as a loop counter.
+ * @pos:       the &struct hlist_node to use as a loop counter.
+ * @member:    the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_continue(tpos, pos, member)                \
+       for (pos = (pos)->next;                                          \
+            pos && ({ prefetch(pos->next); 1;}) &&                      \
+               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+            pos = pos->next)
+
+/**
+ * hlist_for_each_entry_from - iterate over a hlist continuing from existing point
+ * @tpos:      the type * to use as a loop counter.
+ * @pos:       the &struct hlist_node to use as a loop counter.
+ * @member:    the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_from(tpos, pos, member)                    \
+       for (; pos && ({ prefetch(pos->next); 1;}) &&                    \
+               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+            pos = pos->next)
+
+/**
+ * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @tpos:      the type * to use as a loop counter.
+ * @pos:       the &struct hlist_node to use as a loop counter.
+ * @n:         another &struct hlist_node to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_safe(tpos, pos, n, head, member)           \
+       for (pos = (head)->first;                                        \
+            pos && ({ n = pos->next; 1; }) &&                           \
+               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+            pos = n)
+
+
+#endif
diff --git a/palacios/scripts/make_payload.pl b/palacios/scripts/make_payload.pl
new file mode 100755 (executable)
index 0000000..f39ea9e
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+$magic = 0xf1e2d3c4;
+
+use FileHandle;
+
+if (scalar(@ARGV) != 2) {
+  print STDERR "usage: make_payload.pl <cfg-file> <out-file>\n";
+  exit 1;
+}
+
+my $config_file = shift @ARGV;
+my $out_file = shift @ARGV;
+
+open (CFGFILE, "$config_file");
+@cfg = <CFGFILE>;
+close CFGFILE;
+
+my $num_regions = 0;
+
+my @region_names = ();
+my %region_map = {};
+
+foreach $line (@cfg) {
+  chomp $line;
+  ($file, $dst) = split(/:/, $line);
+  push @region_names, $file;
+  $region_map{$file} = hex($dst); #unpack('N', pack("h8",$dst));
+  print "" . hex($dst) . "\n";
+  $num_regions++;
+}
+
+
+
+my $fh = new FileHandle(">$out_file");
+binmode $fh;
+
+syswrite $fh, pack('L', $magic), 4;
+syswrite $fh, pack('L', $num_regions), 4;
+
+foreach $file (@region_names) {
+  my $size = (-s $file);
+
+  print "$file to " .  $region_map{$file}. " ($size bytes)\n";
+  syswrite $fh, pack('L', $size), 4;
+  syswrite $fh, pack('L', $region_map{$file}), 4;
+}
+
+
+my $file;
+while (($file = shift @region_names)) {
+  my $in_fh = new FileHandle("<$file");
+  (defined $in_fh) || die "Couldn't open $file: $!\n";
+  binmode $in_fh;
+
+  my $buf = chr(0) x 1024;
+  my $n;
+  while (($n = sysread($in_fh, $buf, 1024)) > 0) {
+    syswrite($fh, $buf, $n);
+  }
+  $in_fh->close();
+}
+
+
+$fh->close();
diff --git a/palacios/src/devices/README b/palacios/src/devices/README
new file mode 100644 (file)
index 0000000..087a0e1
--- /dev/null
@@ -0,0 +1,41 @@
+This is how devices are hooked into the system:
+This is very similar to Linux Modules and device drivers.
+
+
+Devices are kept in their own directory structure: 
+SOURCE => src/devices
+HEADERS => include/devices
+
+
+Each device implements the following:
+ * a create_[device] function that returns a (struct vm_device *).
+ * a set of operations found in (struct vm_device_ops).
+       (currently only init and deinit are called, the rest are not fully thought out...)
+
+The control flow goes like this:
+
+1. The VMM calls create_[device]() which returns a (struct vm_device *). 
+
+2. This function calls create_device(char *name, struct vm_device_ops * ops, void * private_data);
+ * The arguments are device specific, and the pointer is returned to the VMM. No instance 
+       specific initialization should be done here
+
+3. The VMM then calls attach_device(struct guest_info * vm, struct vm_device * dev) to associate the 
+       device with a virtual machine
+
+4. attach_device then calls the ops->init() function found in the (struct vm_device *)
+ * This init function is where all the instance specific initialization is done. A pointer to the virtual machine
+       the device is associated with is stored in vm_device->vm.
+ * Any event hooks should be done here.
+
+
+
+Disconnection goes like this: 
+
+1. The VMM calls unattach_device(struct vm_device * dev)
+
+2. unattach_device calls the ops->deinit() function found in the (struct vm_device *)
+ * All the instance specific deinitialization should be done here
+ * Any event hooks that were taken should be released
+
+3. The VMM then calls free_device(struct vm_device * dev);
index fb5b9eb..e811ec2 100644 (file)
@@ -10,7 +10,7 @@ extern struct vmm_os_hooks *os_hooks;
 
 
 
-typedef enum {NVRAM_READY,NVRAM_REG_POSTED} nvram_state_t;
+typedef enum {NVRAM_READY, NVRAM_REG_POSTED} nvram_state_t;
 
 
 #define NVRAM_REG_MAX   256
@@ -52,7 +52,7 @@ struct nvram_internal {
 
 
 
-int nvram_reset_device(struct vm_device *dev)
+int nvram_reset_device(struct vm_device * dev)
 {
   struct nvram_internal *data = (struct nvram_internal *) dev->private_data;
   
@@ -63,140 +63,106 @@ int nvram_reset_device(struct vm_device *dev)
 
 }
 
-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)
+int nvram_start_device(struct vm_device *dev)
 {
-
-  nvram_reset_device(dev);
-  
-  dev_mgr_unhook_device(dev->vm,dev);
-
   return 0;
 }
 
 
+int nvram_stop_device(struct vm_device *dev)
+{
+  return 0;
+}
 
 
 
 
-int nvram_start_device(struct vm_device *dev)
+int nvram_write_reg_port(ushort_t port,
+                       void * src, 
+                       uint_t length,
+                       struct vm_device * dev)
 {
-  return 0;
-}
+  struct nvram_internal *data = (struct nvram_internal *) dev->private_data;
 
+  memcpy(&(data->thereg), src, 1);
 
-int nvram_stop_device(struct vm_device *dev)
-{
   return 0;
 }
 
 
-
-int nvram_read_io_port(ushort_t port_read,
-                      void   *address, 
+int nvram_read_data_port(ushort_t port,
+                      void   * dst, 
                       uint_t length,
-                      struct vm_device *dev)
+                      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;
-  }
+  memcpy(dst, &(data->mem_state[data->thereg]), 1);
+
   return 0;
 }
 
-int nvram_write_io_port(ushort_t port_written,
-                       void   *address, 
+int nvram_write_data_port(ushort_t port,
+                       void * src, 
                        uint_t length,
-                       struct vm_device *dev)
+                       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;
-  }
+  memcpy(&(data->mem_state[data->thereg]), src, 1);
+
   return 0;
 }
 
-int nvram_read_mapped_memory(void   *address_read,
-                            void   *address, 
-                            uint_t length,
-                            struct vm_device *dev)
-{
-  return -1;
 
+
+int nvram_init_device(struct vm_device * dev) {
+  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_hook_io(dev, NVRAM_REG_PORT, NULL, &nvram_write_reg_port);
+  dev_hook_io(dev, NVRAM_DATA_PORT, &nvram_read_data_port, &nvram_write_data_port);
+  
+  return 0;
 }
 
-int nvram_write_mapped_memory(void   *address_written,
-                             void   *address, 
-                             uint_t length,
-                             struct vm_device *dev)
+int nvram_deinit_device(struct vm_device *dev)
 {
-  return -1;
+
+
+  dev_unhook_io(dev, NVRAM_REG_PORT);
+  dev_unhook_io(dev, NVRAM_DATA_PORT);
+
+  nvram_reset_device(dev);
+  return 0;
 }
 
 
-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));
+static struct vm_device_ops dev_ops = { 
+  .init = nvram_init_device, 
+  .deinit = nvram_deinit_device,
+  .reset = nvram_reset_device,
+  .start = nvram_start_device,
+  .stop = nvram_stop_device,
+};
+
+
 
-  *device = nvram_template;
+struct vm_device *nvram_create() {
+  struct nvram_internal * nvram_state = os_hooks->malloc(sizeof(struct nvram_internal));
 
-  device->private_data = os_hooks->malloc(sizeof(struct nvram_internal));
+  struct vm_device *device = create_device("NVRAM", &dev_ops, nvram_state);
 
   return device;
 }
index aa3d7a1..a8ef613 100644 (file)
@@ -4,6 +4,8 @@
 #include <geekos/serial.h>
 #include <geekos/vm.h>
 #include <geekos/screen.h>
+#include <palacios/vmm_dev_mgr.h>
+#include <devices/nvram.h>
 
 #define SPEAKER_PORT 0x61
 
@@ -172,7 +174,7 @@ int RunVMM(struct Boot_Info * bootInfo) {
     os_hooks.vaddr_to_paddr = &Identity;
     os_hooks.paddr_to_vaddr = &Identity;
 
-
     //   DumpGDT();
     Init_VMM(&os_hooks, &vmm_ops);
   
@@ -284,6 +286,14 @@ int RunVMM(struct Boot_Info * bootInfo) {
       hook_io_port(&(vm_info.io_map), 0x402, &IO_Read, &IO_BOCHS_debug, NULL);
       hook_io_port(&(vm_info.io_map), 0x403, &IO_Read, &IO_Write_to_Serial, NULL);
 
+      {
+       struct vm_device * nvram = nvram_create();
+       attach_device(&(vm_info), nvram);
+       
+       PrintDebugDevMgr(&(vm_info.dev_mgr));
+       
+      }
+
       vm_info.rip = 0xfff0;
       vm_info.vm_regs.rsp = 0x0;
     }
index 2003ba7..296559f 100644 (file)
 #include <palacios/vm_guest_mem.h>
 
 
-/* TEMPORARY BECAUSE SVM IS WEIRD */
-//#include <palacios/tss.h>
-/* ** */
-
 
 extern struct vmm_os_hooks * os_hooks;
 
@@ -377,7 +373,7 @@ void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info vm_info) {
       uchar_t * bitmap = (uchar_t *)io_port_bitmap;
 
       bitmap += (port / 8);
-      PrintDebug("Setting Bit in block %x\n", bitmap);
+      PrintDebug("Setting Bit for port 0x%x\n", port);
       *bitmap |= 1 << (port % 8);
     }
 
index 6a14ddd..f7e39de 100644 (file)
@@ -22,18 +22,13 @@ int handle_svm_exit(struct guest_info * info) {
   info->rip = guest_state->rip;
   info->vm_regs.rsp = guest_state->rsp;
   info->vm_regs.rax = guest_state->rax;
-  info->vm_regs.rsp = guest_state->rsp;
-
-
-
-  
+  info->vm_regs.rsp = guest_state->rsp;  
 
 
   exit_code = guest_ctrl->exit_code;
-  
   // PrintDebugVMCB((vmcb_t*)(info->vmm_data));
 
-  
   if (exit_code == VMEXIT_IOIO) {
     struct svm_io_info * io_info = (struct svm_io_info *)&(guest_ctrl->exit_info1);
     
diff --git a/palacios/src/palacios/vm_dev.c b/palacios/src/palacios/vm_dev.c
new file mode 100644 (file)
index 0000000..1f2a725
--- /dev/null
@@ -0,0 +1,37 @@
+#include <palacios/vm_dev.h>
+#include <palacios/vmm.h>
+
+
+
+struct vm_device * allocate_device() {
+
+  struct vm_device * dev = NULL;
+  VMMMalloc(struct vm_device *, dev, sizeof(struct vm_device));
+
+  dev->ops = NULL;
+  memset(dev->name, 0, 32);
+  dev->vm = NULL;
+  dev->private_data = NULL;
+
+  dev->next = NULL;
+  dev->prev = NULL;
+  dev->io_hooks.head = NULL;
+  dev->mem_hooks.head = NULL;
+  dev->io_hooks.num_hooks = 0;
+  dev->mem_hooks.num_hooks = 0;
+  return dev;
+}
+
+struct vm_device * create_device(char * name, struct vm_device_ops * ops, void * private_data) {
+  struct vm_device * dev = allocate_device();
+
+  strncpy(dev->name, name, 32);
+  dev->ops = ops;
+  dev->private_data = private_data;
+
+  return dev;
+}
+
+void free_device(struct vm_device * dev) {
+  VMMFree(dev);
+}
index 81f053c..615c8ec 100644 (file)
-
-#include <palacios/vmm_dev.h>
+#include <palacios/vm_dev.h>
 #include <palacios/vmm_dev_mgr.h>
 #include <palacios/vm_guest.h>
 #include <palacios/vmm.h>
 
+
 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;
+int dev_mgr_init(struct vmm_dev_mgr * mgr) {
+  mgr->dev_list.head = NULL;
+  mgr->dev_list.num_devs = 0;
   return 0;
 }
 
 
-int dev_mgr_deinit(struct vmm_dev_mgr *mgr)
+int dev_mgr_deinit(struct vmm_dev_mgr * mgr)
 {
-  int rc;
+  struct vm_device * dev = mgr->dev_list.head;
 
-  while (mgr->dev_list) { 
-    rc=dev_mgr_detach_device(mgr->vm,mgr->dev_list);
-    if (rc) { 
-      // Bad bad bad
-    }
+  while (dev) { 
+    unattach_device(dev);
+    free_device(dev);
+    dev = dev->next;
   }
   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;
+
+
+
+int dev_mgr_add_device(struct vmm_dev_mgr * mgr, struct vm_device * dev) {
+  dev->next = mgr->dev_list.head;
+  dev->prev = 0;
+  if (dev->next) { 
+    dev->next->prev = dev;
   }
+  mgr->dev_list.head = dev;
+
+  mgr->dev_list.num_devs++;
+
+  return 0;
+}
 
-  device->next = mgr->dev_list;
-  device->prev = 0;
-  if (device->next) { 
-    device->next->prev = device;
+int dev_mgr_remove_device(struct vmm_dev_mgr * mgr, struct vm_device * dev) {
+  if (mgr->dev_list.head == dev) { 
+    mgr->dev_list.head = dev->next;
+  } else {
+    dev->prev->next = dev->next;
+  }
+  if (dev->next) { 
+    dev->next->prev = dev->prev;
   }
-  mgr->dev_list = device;
   
-  device->vm=vm;
+  mgr->dev_list.num_devs--;
 
   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;
+
+int dev_mgr_add_io_hook(struct vmm_dev_mgr * mgr, struct dev_io_hook * hook) {
+  hook->mgr_next = mgr->io_hooks.head;
+  hook->mgr_prev = NULL;
+  if (hook->mgr_next) {
+    hook->mgr_next->mgr_prev = hook;
+  }
+  mgr->io_hooks.head = hook;
+
+  mgr->io_hooks.num_hooks++;
+
+  return 0;
+}
+
+
+int dev_mgr_remove_io_hook(struct vmm_dev_mgr * mgr, struct dev_io_hook * hook) {
+  if (mgr->io_hooks.head == hook) {
+    mgr->io_hooks.head = hook->mgr_next;
   } else {
-    device->prev->next = device->next;
+    hook->mgr_prev->mgr_next = hook->mgr_next;
   }
-  if (device->next) { 
-    device->next->prev=device->prev;
+
+  if (hook->mgr_next) {
+    hook->mgr_next->mgr_prev = hook->mgr_prev;
   }
   
-  // avoid interrupts here
-
-  device->deinit_device(device);
+  mgr->io_hooks.num_hooks--;
 
-  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_add_io_hook(struct vm_device * dev, struct dev_io_hook * hook) {
+  hook->dev_next = dev->io_hooks.head;
+  hook->dev_prev = NULL;
+  if (hook->dev_next) {
+    hook->dev_next->dev_prev = hook;
+  }
+  dev->io_hooks.head = hook;
 
-   
+  dev->io_hooks.num_hooks++;
 
-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;
+  return 0;
+}
+
+
+int dev_remove_io_hook(struct vm_device * dev, struct dev_io_hook * hook) {
+  if (dev->io_hooks.head == hook) {
+    dev->io_hooks.head = hook->dev_next;
+  } else {
+    hook->dev_prev->dev_next = hook->dev_next;
   }
 
-  int (*read)(ushort_t, void *, uint_t, void *) = NULL;
-  int (*write)(ushort_t, void *, uint_t, void *) = NULL;
+  if (hook->dev_next) {
+    hook->dev_next->dev_prev = hook->dev_prev;
+  }
+  
+  dev->io_hooks.num_hooks--;
 
-  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);
+  return 0;
+}
+
+
+struct dev_io_hook * dev_mgr_find_io_hook(struct vmm_dev_mgr * mgr, ushort_t port) {
+  struct dev_io_hook * tmp = mgr->io_hooks.head;
+
+  while (tmp) {
+    if (tmp->port == 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);
+    }
+    tmp = tmp->mgr_next;
+  }
+
+  return tmp;
+}
+
+struct dev_io_hook * dev_find_io_hook(struct vm_device * dev, ushort_t port) {
+  struct dev_io_hook * tmp = dev->io_hooks.head;
+
+  while (tmp) {
+    if (tmp->port == port) {
       break;
     }
-    break;
-  case DEVICE_PASSTHROUGH:
-    read=write=NULL;
-    break;
+    tmp = tmp->dev_next;
   }
-    
-  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 tmp;
+}
+
+
+
+
+int attach_device(struct guest_info * vm, struct vm_device * dev) {
+  struct vmm_dev_mgr *mgr= &(vm->dev_mgr);
   
+  dev->vm = vm;
+  dev_mgr_add_device(mgr, dev);
+  dev->ops->init(dev);
+
   return 0;
 }
 
+int unattach_device(struct vm_device * dev) {
+  struct vmm_dev_mgr * mgr = &(dev->vm->dev_mgr);
 
-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;
+  dev->ops->deinit(dev);
+  dev_mgr_remove_device(mgr, dev);
+  dev->vm = NULL;
 
-  while (hook) { 
-    if (hook->guest_port==portno) { 
-      DELETE(device->io_hooks,hook);
-      break;
-    }
+  return 0;
+}
+
+
+
+int dev_hook_io(struct vm_device   *dev,
+               ushort_t            port,
+               int (*read)(ushort_t port, void * dst, uint_t length, struct vm_device * dev),
+               int (*write)(ushort_t port, void * src, uint_t length, struct vm_device * dev)) {
+
+  struct dev_io_hook *hook = os_hooks->malloc(sizeof(struct dev_io_hook));
+  
+  if (!hook) { 
+    return -1;
+  }
+
+
+  if (hook_io_port(&(dev->vm->io_map), port, 
+                  (int (*)(ushort_t, void *, uint_t, void *))read, 
+                  (int (*)(ushort_t, void *, uint_t, void *))write, 
+                  (void *)dev) == 0) {
+
+    hook->dev = dev;
+    hook->port = port;
+    hook->read = read;
+    hook->write = write;
+    
+    dev_mgr_add_io_hook(&(dev->vm->dev_mgr), hook);
+    dev_add_io_hook(dev, hook);
+  } else {
+    return -1;
   }
 
+  return 0;
+}
+
+
+int dev_unhook_io(struct vm_device   *dev,
+                 ushort_t            port) {
+
+  struct vmm_dev_mgr * mgr = &(dev->vm->dev_mgr);
+  struct dev_io_hook * hook = dev_mgr_find_io_hook(mgr, port);
+
   if (!hook) { 
-    // Very bad - unhooking something that doesn't exist!
     return -1;
   }
 
-  return unhook_io_port(&(vm->io_map),
-                       portno);
+  dev_mgr_remove_io_hook(mgr, hook);
+  dev_remove_io_hook(dev, hook);
+
+  return unhook_io_port(&(dev->vm->io_map), port);
 }
 
 
 
 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)
+                    void               *start,
+                    void               *end)
 {
 
-  struct vm_device_mem_hook *hook = os_hooks->malloc(sizeof(struct vm_device_mem_hook));
+  struct dev_mem_hook *hook = os_hooks->malloc(sizeof(struct dev_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
@@ -228,13 +251,9 @@ int dev_mgr_hook_mem(struct guest_info    *vm,
 
   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);
+  hook->addr_start = start;
+  hook->addr_end = end;
 
   return 0;
   
@@ -243,15 +262,13 @@ int dev_mgr_hook_mem(struct guest_info    *vm,
 
 int dev_mgr_unhook_mem(struct guest_info    *vm,
                       struct vm_device   *device,
-                      void               *guest_physical_start,
-                      void               *guest_physical_end) 
+                      void               *start,
+                      void               *end) 
 {
-  struct vm_device_mem_hook *hook = device->mem_hooks;
+  struct dev_mem_hook *hook = device->mem_hooks.head;
 
   while (hook) { 
-    if (hook->guest_physical_start==guest_physical_start &&
-       hook->guest_physical_end==guest_physical_end) {
-      DELETE(device->mem_hooks,hook);
+    if (((hook->addr_start) == start) && (hook->addr_end == end)) {
       break;
     }
   }
@@ -272,24 +289,39 @@ int dev_mgr_unhook_mem(struct guest_info    *vm,
 }
 
 
-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;
-    }
+void PrintDebugDevMgr(struct vmm_dev_mgr * mgr) {
+  struct vm_device * dev = mgr->dev_list.head;
+
+  while (dev) {
+    PrintDebugDev(dev);
+    dev = dev->next;
   }
 
-  return 0;
+  return;
+}
+
+
+void PrintDebugDev(struct vm_device * dev) {
+  
+  PrintDebug("Device: %s\n", dev->name);
+  PrintDebugDevIO(dev);
+}
+
+void PrintDebugDevMgrIO(struct vmm_dev_mgr * mgr) {
+
 }
 
+void PrintDebugDevIO(struct vm_device * dev) {
+  struct dev_io_hook * hook = dev->io_hooks.head;
+  
+  PrintDebug("IO Hooks (%d) for Device: %s\n", dev->io_hooks.num_hooks, dev->name);
+  
+  while (hook) {
+    PrintDebug("\tPort: 0x%x (read=0x%x), (write=0x%x)\n", hook->port, hook->read, hook->write);
+    hook = hook->dev_next;
+  }
+
+  return;
+}
index 350eb29..f57bf39 100644 (file)
@@ -4,6 +4,10 @@
 
 extern struct vmm_os_hooks * os_hooks;
 
+
+
+
+
 void init_vmm_io_map(vmm_io_map_t * io_map) {
   io_map->num_ports = 0;
   io_map->head = NULL;
@@ -11,52 +15,58 @@ void init_vmm_io_map(vmm_io_map_t * io_map) {
 
 
 
-void add_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook) {
-  vmm_io_hook_t * tmp_hook = io_map->head;
+int add_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook) {
 
-  if (!tmp_hook) {
+  if (!(io_map->head)) {
     io_map->head = io_hook;
     io_map->num_ports = 1;
-    return;
+    return 0;
+  } else if (io_map->head->port > io_hook->port) {
+    io_hook->next = io_map->head;
+
+    io_map->head->prev = io_hook;
+    io_map->head = io_hook;
+    io_map->num_ports++;
+
+    return 0;
   } else {
+    vmm_io_hook_t * tmp_hook = io_map->head;
+    
     while ((tmp_hook->next)  && 
           (tmp_hook->next->port <= io_hook->port)) {
-      tmp_hook = tmp_hook->next;
+       tmp_hook = tmp_hook->next;
     }
     
     if (tmp_hook->port == io_hook->port) {
-      tmp_hook->read = io_hook->read;
-      tmp_hook->write = io_hook->write;
-      
-      VMMFree(io_hook);
-      return;
-    } else if (!tmp_hook->next) {
-      tmp_hook->next = io_hook;
-      io_hook->prev = tmp_hook;
-      io_map->num_ports++;
+      //tmp_hook->read = io_hook->read;
+      //tmp_hook->write = io_hook->write;
       
-      return;
+      //VMMFree(io_hook);
+      return -1;
     } else {
-      io_hook->next = tmp_hook->next;
       io_hook->prev = tmp_hook;
-      
-      tmp_hook->next = io_hook;
-      if (io_hook->next) {
-       io_hook->next->prev = io_hook;
+      io_hook->next = tmp_hook->next;
+
+      if (tmp_hook->next) {
+       tmp_hook->next->prev = io_hook;
       }
-      
+
+      tmp_hook->next = io_hook;
+
       io_map->num_ports++;
-      return;
+      return 0;
     }
   }
+  return -1;
 }
 
-void remove_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook) {
+int remove_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook) {
   if (io_map->head == io_hook) {
     io_map->head = io_hook->next;
   } else if (io_hook->prev) {
     io_hook->prev->next = io_hook->next;
   } else {
+    return -1;
     // data corruption failure
   }
   
@@ -66,27 +76,87 @@ void remove_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook) {
 
   io_map->num_ports--;
 
-  return;
+  return 0;
+}
+
+
+
+/* FIX ME */
+static int default_write(ushort_t port, void *src, uint_t length, void * priv_data) {
+  /*
+    
+  if (length == 1) {
+  __asm__ __volatile__ (
+  "outb %b0, %w1"
+  :
+  : "a" (*dst), "Nd" (port)
+  );
+  } else if (length == 2) {
+  __asm__ __volatile__ (
+  "outw %b0, %w1"
+  :
+  : "a" (*dst), "Nd" (port)
+  );
+  } else if (length == 4) {
+  __asm__ __volatile__ (
+  "outw %b0, %w1"
+  :
+  : "a" (*dst), "Nd" (port)
+  );
+  }
+  */
+  return 0;
 }
 
+static int default_read(ushort_t port, void * dst, uint_t length, void * priv_data)
+{
+
+  /*    
+       uchar_t value;
+
+    __asm__ __volatile__ (
+       "inb %w1, %b0"
+       : "=a" (value)
+       : "Nd" (port)
+    );
 
-void hook_io_port(vmm_io_map_t * io_map, uint_t port, 
-                 int (*read)(ushort_t port, void * dst, uint_t length, void * priv_data),
-                 int (*write)(ushort_t port, void * src, uint_t length, void * priv_data), 
-                 void * priv_data) {
+    return value;
+  */
+
+  return 0;
+}
+
+int hook_io_port(vmm_io_map_t * io_map, uint_t port, 
+                int (*read)(ushort_t port, void * dst, uint_t length, void * priv_data),
+                int (*write)(ushort_t port, void * src, uint_t length, void * priv_data), 
+                void * priv_data) {
   vmm_io_hook_t * io_hook = os_hooks->malloc(sizeof(vmm_io_hook_t));
 
   io_hook->port = port;
-  io_hook->read = read;
-  io_hook->write = write;
+
+  if (!read) {
+    io_hook->read = &default_read;
+  } else {
+    io_hook->read = read;
+  }
+
+  if (!write) {
+    io_hook->write = &default_write;
+  } else {
+    io_hook->write = write;
+  }
+
   io_hook->next = NULL;
   io_hook->prev = NULL;
 
   io_hook->priv_data = priv_data;
 
-  add_io_hook(io_map, io_hook);
+  if (add_io_hook(io_map, io_hook) != 0) {
+    VMMFree(io_hook);
+    return -1;
+  }
 
-  return;
+  return 0;
 }
 
 int unhook_io_port(vmm_io_map_t * io_map, uint_t port) {