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.


consolidated hypercall numbers\030
Jack Lange [Thu, 4 Feb 2010 03:47:09 +0000 (21:47 -0600)]
palacios/include/palacios/vmm_hypercall.h
palacios/src/devices/lnx_virtio_balloon.c
palacios/src/devices/os_debug.c
palacios/src/palacios/vmm_hypercall.c
palacios/src/palacios/vmm_mem.c
palacios/src/palacios/vmm_sym_iface.c

index 333c812..c9646fa 100644 (file)
@@ -30,11 +30,28 @@ typedef struct rb_root v3_hypercall_map_t;
 struct guest_info;
 struct v3_vm_info;
 
+
+
+typedef enum {
+    TEST_HCALL =           0x0001,
+    SYMCALL_RET_HCALL =    0x0535,         // args in GPRs
+    SYMCALL_ERR_HCALL =    0x0536,         // RBX: error code
+    MEM_OFFSET_HCALL =     0x1000,         // RBX: base addr(out)
+    GUEST_INFO_HCALL =     0x3000,         // no args
+    TELEMETRY_HCALL =      0x3001,         // no args
+    BALLOON_START_HCALL =  0xba00,         // RAX: size
+    BALLOON_QUERY_HCALL =  0xba01,         // RCX: req_pgs(out), RDX: alloc_pgs(out)
+    OS_DEBUG_HCALL =       0xc0c0          // RBX: msg_gpa, RCX: msg_len, RDX: buf_is_va (flag)
+} hcall_id_t;
+
+
+
+
 void v3_init_hypercall_map(struct v3_vm_info * vm);
 
 
-int v3_register_hypercall(struct v3_vm_info * vm, uint_t hypercall_id, 
-                         int (*hypercall)(struct guest_info * info , uint_t hcall_id, void * priv_data),
+int v3_register_hypercall(struct v3_vm_info * vm, hcall_id_t hypercall_id, 
+                         int (*hypercall)(struct guest_info * info , hcall_id_t hcall_id, void * priv_data),
                          void * priv_data);
 
 
@@ -43,14 +60,6 @@ int v3_handle_hypercall(struct guest_info * info);
 
 
 
-typedef enum {
-    MEM_OFFSET_HCALL = 0x1000, 
-    GUEST_INFO_HCALL = 0x3000,
-    TELEMETRY_HCALL = 0x3001,
-    OS_DEBUG_HCALL = 0xc0c0
-} hcall_id_t;
-
-
 
 #endif
 
index c5b621e..4850bc6 100644 (file)
@@ -31,8 +31,6 @@
 
 #define PAGE_SIZE 4096
 
-#define BALLOON_START_HCALL 0xba00 // size in rax
-#define BALLOON_QUERY_HCALL 0xba01 // req_pgs in rcx, alloc_pgs in rdx
 
 struct balloon_config {
     uint32_t requested_pages;
index 4d7e19a..53346a2 100644 (file)
@@ -26,7 +26,6 @@
 #define BUF_SIZE 1024
 
 #define DEBUG_PORT1 0xc0c0
-#define DEBUG_HCALL 0xc0c0
 
 struct debug_state {
     char debug_buf[BUF_SIZE];
@@ -120,7 +119,7 @@ static int debug_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     }
 
     v3_dev_hook_io(dev, DEBUG_PORT1,  NULL, &handle_gen_write);
-    v3_register_hypercall(vm, DEBUG_HCALL, handle_hcall, dev);
+    v3_register_hypercall(vm, OS_DEBUG_HCALL, handle_hcall, dev);
 
     state->debug_offset = 0;
     memset(state->debug_buf, 0, BUF_SIZE);
index 05a6630..7dda3a4 100644 (file)
@@ -22,9 +22,7 @@
 #include <palacios/vm_guest.h>
 
 
-#define HYPERCALL_TEST_HCALL 0x1
-
-static int hcall_test(struct guest_info * info, uint_t hcall_id, void * private_data) {
+static int hcall_test(struct guest_info * info, hcall_id_t hcall_id, void * private_data) {
     info->vm_regs.rbx = 0x1111;
     info->vm_regs.rcx = 0x2222;
     info->vm_regs.rdx = 0x3333;
@@ -38,14 +36,14 @@ static int hcall_test(struct guest_info * info, uint_t hcall_id, void * private_
 void v3_init_hypercall_map(struct v3_vm_info * vm) {
     vm->hcall_map.rb_node = NULL;
 
-    v3_register_hypercall(vm, HYPERCALL_TEST_HCALL, hcall_test, NULL);
+    v3_register_hypercall(vm, TEST_HCALL, hcall_test, NULL);
 }
 
 
 struct hypercall {
     uint_t id;
   
-    int (*hcall_fn)(struct guest_info * info, uint_t hcall_id, void * priv_data);
+    int (*hcall_fn)(struct guest_info * info, hcall_id_t hcall_id, void * priv_data);
     void * priv_data;
   
     struct rb_node tree_node;
@@ -90,7 +88,7 @@ static inline struct hypercall * insert_hypercall(struct v3_vm_info * vm, struct
 }
 
 
-static struct hypercall * get_hypercall(struct v3_vm_info * vm, uint_t id) {
+static struct hypercall * get_hypercall(struct v3_vm_info * vm, hcall_id_t id) {
     struct rb_node * n = vm->hcall_map.rb_node;
     struct hypercall * hcall = NULL;
 
@@ -110,8 +108,8 @@ static struct hypercall * get_hypercall(struct v3_vm_info * vm, uint_t id) {
 }
 
 
-int v3_register_hypercall(struct v3_vm_info * vm, uint_t hypercall_id, 
-                         int (*hypercall)(struct guest_info * info, uint_t hcall_id, void * priv_data), 
+int v3_register_hypercall(struct v3_vm_info * vm, hcall_id_t hypercall_id, 
+                         int (*hypercall)(struct guest_info * info, hcall_id_t hcall_id, void * priv_data), 
                          void * priv_data) {
 
     struct hypercall * hcall = (struct hypercall *)V3_Malloc(sizeof(struct hypercall));
@@ -130,8 +128,7 @@ int v3_register_hypercall(struct v3_vm_info * vm, uint_t hypercall_id,
 
 
 int v3_handle_hypercall(struct guest_info * info) {
-    uint_t hypercall_id = *(uint_t *)&info->vm_regs.rax;
-
+    hcall_id_t hypercall_id = *(uint_t *)&info->vm_regs.rax;
     struct hypercall * hcall = get_hypercall(info->vm_info, hypercall_id);
 
     if (!hcall) {
index 0c66a43..f2d527a 100644 (file)
@@ -26,8 +26,6 @@
 #include <palacios/vmm_shadow_paging.h>
 #include <palacios/vmm_direct_paging.h>
 
-#define MEM_OFFSET_HCALL 0x1000
-
 
 static inline
 struct v3_shadow_region * insert_shadow_region(struct v3_vm_info * vm, 
index 474ea0b..9b3a090 100644 (file)
@@ -33,8 +33,6 @@
 
 // A succesfull symcall returns via the RET_HCALL, with the return values in registers
 // A symcall error returns via the ERR_HCALL with the error code in rbx
-#define SYM_CALL_RET_HCALL 0x535
-#define SYM_CALL_ERR_HCALL 0x536
 
 
 /* Notes: We use a combination of SYSCALL and SYSENTER Semantics 
@@ -237,8 +235,8 @@ int v3_init_sym_iface(struct v3_vm_info * vm) {
     v3_hook_msr(vm, SYMCALL_GS_MSR, symcall_msr_read, symcall_msr_write, NULL);
     v3_hook_msr(vm, SYMCALL_FS_MSR, symcall_msr_read, symcall_msr_write, NULL);
 
-    v3_register_hypercall(vm, SYM_CALL_RET_HCALL, sym_call_ret, NULL);
-    v3_register_hypercall(vm, SYM_CALL_ERR_HCALL, sym_call_err, NULL);
+    v3_register_hypercall(vm, SYMCALL_RET_HCALL, sym_call_ret, NULL);
+    v3_register_hypercall(vm, SYMCALL_ERR_HCALL, sym_call_err, NULL);
 
     return 0;
 }