X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fnvram.c;h=10574e4e7d45129679660648529d3e08f72fa22e;hb=990ef457de6998f79947c81a16c8e7f843e784c0;hp=a8bfc53f6b3497843ec9b8b5ddeb6fe0003956fd;hpb=debabd511ff9dc2d0e6cd608045ac44295fe7319;p=palacios-OLD.git diff --git a/palacios/src/devices/nvram.c b/palacios/src/devices/nvram.c index a8bfc53..10574e4 100644 --- a/palacios/src/devices/nvram.c +++ b/palacios/src/devices/nvram.c @@ -462,7 +462,7 @@ static void set_memory_size(struct nvram_internal * nvram, addr_t bytes) { { // Set the extended memory beyond 16 MB in 64k chunks - uint16_t mem_chunks = bytes * (1024 / 64); + uint16_t mem_chunks = (bytes - (1024 * 1024 * 16)) / (1024 * 64); nvram->mem_state[NVRAM_REG_AMI_BIG_MEMORY_HIGH] = (mem_chunks >> 8) & 0x00ff; nvram->mem_state[NVRAM_REG_AMI_BIG_MEMORY_LOW] = mem_chunks & 0x00ff; } @@ -474,15 +474,7 @@ static int init_nvram_state(struct vm_device * dev) { struct guest_info * info = dev->vm; struct nvram_internal * nvram_state = (struct nvram_internal *)dev->private_data; - /* TODO: - * The amount of ram in the system is stored in info->mem_size - * We need to reflect that value correctly here - */ - PrintError("TODO: Set the nvram memory register to reflect info->mem_size (%p)\n", (void *)(info->mem_size)); - - - memset(nvram_state->mem_state, 0, NVRAM_REG_MAX); - + memset(nvram_state->mem_state, 0, NVRAM_REG_MAX); // // 2 1.44 MB floppy drives @@ -549,7 +541,7 @@ static int init_nvram_state(struct vm_device * dev) { nvram_state->us = 0; nvram_state->pus = 0; - set_memory_size(nvram_state, dev->vm->mem_size); + set_memory_size(nvram_state, info->mem_size); nvram_state->dev_state = NVRAM_READY; nvram_state->thereg = 0;