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.


small fixes to swint code, add proper cleanup
[palacios.releases.git] / palacios / src / devices / nvram.c
index cda167e..8c8830b 100644 (file)
@@ -713,11 +713,14 @@ static int init_nvram_state(struct v3_vm_info * vm, struct nvram_internal * nvra
 
 static int nvram_write_reg_port(struct guest_info * core, uint16_t port,
                                void * src, uint_t length, void * priv_data) {
-
+    uint8_t reg;
     struct nvram_internal * data = priv_data;
+
+    memcpy(&reg,src,1);
+
+    data->thereg = reg & 0x7f;  //discard NMI bit if it's there
     
-    memcpy(&(data->thereg), src, 1);
-    PrintDebug("nvram: Writing To NVRAM reg: 0x%x\n", data->thereg);
+    PrintDebug("nvram: Writing To NVRAM reg: 0x%x (NMI_disable=%d)\n", data->thereg,reg>>7);
 
     return 1;
 }
@@ -809,6 +812,11 @@ static int nvram_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     PrintDebug("nvram: init_device\n");
     nvram_state = (struct nvram_internal *)V3_Malloc(sizeof(struct nvram_internal) + 1000);
 
+    if (!nvram_state) {
+       PrintError("Cannot allocate in init\n");
+       return -1;
+    }
+
     PrintDebug("nvram: internal at %p\n", (void *)nvram_state);
 
     nvram_state->ide = ide;