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.


updates to make things more configurable
Jack Lange [Wed, 2 Mar 2011 22:14:24 +0000 (16:14 -0600)]
palacios/include/palacios/vmm_extensions.h [new file with mode: 0644]
palacios/include/palacios/vmm_mtrr.h [new file with mode: 0644]
palacios/src/palacios/Makefile
palacios/src/palacios/vmm.c
palacios/src/palacios/vmm_extensions.c [new file with mode: 0644]
palacios/src/palacios/vmm_mtrr.c [new file with mode: 0644]

diff --git a/palacios/include/palacios/vmm_extensions.h b/palacios/include/palacios/vmm_extensions.h
new file mode 100644 (file)
index 0000000..c6a2ae2
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#ifndef __VMM_EXTENSIONS_H__
+#define __VMM_EXTENSIONS_H__
+
+#ifdef __V3VEE__
+
+#include <palacios/vmm.h>
+#include <palacios/vmm_list.h>
+#include <palacios/vm_guest.h>
+
+struct v3_extension_impl {
+    char * name;
+    int (*init)(struct v3_vm_info * vm, v3_cfg_tree_t * cfg);
+    int (*deinit)(struct v3_vm_info * vm, void * priv_data);
+    int (*core_init)(struct guest_info * core);
+    int (*core_deinit)(struct guest_info * core);
+};
+
+
+
+struct v3_extension {
+    struct v3_extension_impl * impl;
+    void * priv_data;
+
+    struct list_head node;
+};
+
+
+
+int V3_init_extensions();
+int V3_deinit_extensions();
+
+
+
+#define register_extension(ext)                                        \
+    static struct v3_extension_impl * _v3_ext                  \
+    __attribute__((used))                                      \
+       __attribute__((unused, __section__("_v3_extensions"),   \
+                      aligned(sizeof(addr_t))))                \
+       = ext;
+
+
+
+#endif
+
+#endif
diff --git a/palacios/include/palacios/vmm_mtrr.h b/palacios/include/palacios/vmm_mtrr.h
new file mode 100644 (file)
index 0000000..0901781
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2011, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#ifndef __VMM_MTRR_H__
+#define __VMM_MTRR_H__
+
+
+#ifdef __V3VEE__
+
+#include <palacios/vmm.h>
+
+
+
+#endif
+
+#endif
index f3b2c0c..8e44ae5 100644 (file)
@@ -35,6 +35,9 @@ obj-y := \
        vmm_muxer.o \
        vmm_mem_hook.o \
        vmm_mptable.o \
+       vmm_extensions.o \
+       vmm_mtrr.o \
+
 
 obj-$(CONFIG_SVM) +=    svm.o \
                        svm_io.o \
index 09b6ff6..c890fda 100644 (file)
@@ -24,6 +24,7 @@
 #include <palacios/vmm_ctrl_regs.h>
 #include <palacios/vmm_lowlevel.h>
 #include <palacios/vmm_sprintf.h>
+#include <palacios/vmm_extensions.h>
 
 #ifdef CONFIG_SVM
 #include <palacios/svm.h>
@@ -112,6 +113,9 @@ void Init_V3(struct v3_os_hooks * hooks, int num_cpus) {
     // Register all shadow paging handlers
     V3_init_shdw_paging();
 
+    // Register all extensions
+    V3_init_extensions();
+
 
 #ifdef CONFIG_SYMMOD
     V3_init_symmod();
@@ -145,6 +149,8 @@ void Shutdown_V3() {
     V3_deinit_devices();
     V3_deinit_shdw_paging();
 
+    V3_deinit_extensions();
+
 #ifdef CONFIG_SYMMOD
     V3_deinit_symmod();
 #endif
diff --git a/palacios/src/palacios/vmm_extensions.c b/palacios/src/palacios/vmm_extensions.c
new file mode 100644 (file)
index 0000000..40a0dd0
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#include <palacios/vmm.h>
+
+#include <palacios/vmm_extensions.h>
+
+#include <palacios/vmm_hashtable.h>
+
+
+static struct hashtable * ext_table = NULL;
+
+
+static uint_t ext_hash_fn(addr_t key) {
+    char * name = (char *)key;
+    return v3_hash_buffer((uint8_t *)name, strlen(name));
+}
+
+static int ext_eq_fn(addr_t key1, addr_t key2) {
+    char * name1 = (char *)key1;
+    char * name2 = (char *)key2;
+
+    return (strcmp(name1, name2) == 0);
+}
+
+
+
+int V3_init_extensions() {
+    extern struct v3_extension_impl * __start__v3_extensions[];
+    extern struct v3_extension_impl * __stop__v3_extensions[];
+    struct v3_extension_impl ** tmp_ext = __start__v3_extensions;
+    int i = 0;
+
+    ext_table = v3_create_htable(0, ext_hash_fn, ext_eq_fn);
+
+    while (tmp_ext != __stop__v3_extensions) {
+       V3_Print("Registering Extension (%s)\n", (*tmp_ext)->name);
+
+       if (v3_htable_search(ext_table, (addr_t)((*tmp_ext)->name))) {
+           PrintError("Multiple instances of Extension (%s)\n", (*tmp_ext)->name);
+           return -1;
+       }
+
+       if (v3_htable_insert(ext_table, (addr_t)((*tmp_ext)->name), (addr_t)(*tmp_ext)) == 0) {
+           PrintError("Could not register Extension (%s)\n", (*tmp_ext)->name);
+           return -1;
+       }
+
+       tmp_ext = &(__start__v3_extensions[++i]);
+    }
+
+    return 0;
+}
+
+
+int V3_deinit_extensions() {
+    v3_free_htable(ext_table, 0, 0);
+    return 0;
+}
+
+
diff --git a/palacios/src/palacios/vmm_mtrr.c b/palacios/src/palacios/vmm_mtrr.c
new file mode 100644 (file)
index 0000000..4c563ce
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2011, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#include <palacios/vmm_mtrr.h>
+#include <palacios/vmm_extensions.h>
+#include <palacios/vmm.h>
+#include <palacios/vm_guest.h>
+#include <palacios/vmm_msr.h>
+
+
+#define MTRR_CAP_MSR       0x00fe
+#define MTRR_PHYS_BASE_0   0x0200
+#define MTRR_PHYS_BASE_1   0x0202
+#define MTRR_PHYS_BASE_2   0x0204
+#define MTRR_PHYS_BASE_3   0x0206
+#define MTRR_PHYS_BASE_4   0x0208
+#define MTRR_PHYS_BASE_5   0x020a
+#define MTRR_PHYS_BASE_6   0x020c
+#define MTRR_PHYS_BASE_7   0x020e
+#define MTRR_PHYS_MASK_0   0x0201
+#define MTRR_PHYS_MASK_1   0x0203
+#define MTRR_PHYS_MASK_2   0x0205
+#define MTRR_PHYS_MASK_3   0x0207
+#define MTRR_PHYS_MASK_4   0x0209
+#define MTRR_PHYS_MASK_5   0x020b
+#define MTRR_PHYS_MASK_6   0x020d
+#define MTRR_PHYS_MASK_7   0x020f
+#define MTRR_FIX_64K_00000 0x0250
+#define MTRR_FIX_16K_80000 0x0258
+#define MTRR_FIX_16K_A0000 0x0259
+#define MTRR_FIX_4K_C0000  0x0268
+#define MTRR_FIX_4K_C8000  0x0269
+#define MTRR_FIX_4K_D0000  0x026a
+#define MTRR_FIX_4K_D8000  0x026b
+#define MTRR_FIX_4K_E0000  0x026c
+#define MTRR_FIX_4K_E8000  0x026d
+#define MTRR_FIX_4K_F0000  0x026e
+#define MTRR_FIX_4K_F8000  0x026f
+
+
+struct mtrr_cap {
+
+
+};
+
+
+struct mtrr_state {
+    struct mtrr_cap cap;
+    
+};
+
+
+static int mtrr_cap_read(struct guest_info * core, uint32_t msr, struct v3_msr * dst, void * priv_data) {
+    return 0;
+}
+
+static int mtrr_cap_write(struct guest_info * core, uint32_t msr, struct v3_msr src, void * priv_data) {
+
+    return 0;
+}
+
+
+
+static int init_mtrrs(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
+
+
+
+    v3_hook_msr(vm, MTRR_CAP_MSR, mtrr_cap_read, mtrr_cap_write, NULL);
+        
+
+    return 0;
+}
+
+
+struct v3_extension_impl mtrr_ext = {
+    .name = "MTRRS",
+    .init = init_mtrrs,
+    .deinit = NULL,
+    .core_init = NULL,
+    .core_deinit = NULL
+};
+
+
+
+register_extension(&mtrr_ext);