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.


deinitialization of interrupt state
[palacios.git] / palacios / src / devices / curses_cons.c
index 90f695d..2a96eb5 100644 (file)
@@ -51,9 +51,14 @@ static int cursor_update(uint_t x, uint_t y, void *private_data)
 {
     struct vm_device *dev = (struct vm_device *) private_data;
     struct cons_state *state = (struct cons_state *) dev->private_data;
-    uint_t offset = (x * BYTES_PER_COL) + (y * BYTES_PER_ROW);
+    uint_t offset;
     uint_t last_x, last_y;
 
+    /* avoid out-of-range coordinates */
+    if (x >= NUM_COLS) x = NUM_COLS - 1;
+    if (y >= NUM_ROWS) y = NUM_ROWS - 1;
+    offset = (x * BYTES_PER_COL) + (y * BYTES_PER_ROW);
+
     /* unfortunately Palacios sometimes misses some writes, 
      * but if they are accompanied by a cursor move we may be able to 
      * detect this
@@ -156,9 +161,7 @@ static int scroll(int rows, void * private_data) {
 }
 
 
-static int cons_free(struct vm_device * dev) {
-    struct cons_state * state = (struct cons_state *)dev->private_data;
-
+static int cons_free(struct cons_state * state) {
     v3_console_close(state->cons);
 
     // remove host event
@@ -183,7 +186,7 @@ static struct v3_console_ops cons_ops = {
 };
 
 static struct v3_device_ops dev_ops = {
-    .free = cons_free,
+    .free = (int (*)(void *))cons_free,
 };
 
 static int cons_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) 
@@ -216,11 +219,9 @@ static int cons_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg)
     }
 
     /* allocate device */
-    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
-    V3_ASSERT(dev);
-
-    /* attach device to virtual machine */
-    if (v3_attach_device(vm, dev) == -1) {
+    struct vm_device * dev = v3_add_device(vm, dev_id, &dev_ops, state);
+    if (dev == NULL) {
        PrintError("Could not attach device %s\n", dev_id);
        V3_Free(state);
        return -1;