diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-05-21 12:53:25 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-05-21 13:19:59 +0200 |
commit | 630ddf38a2a32179c87656d3e1b80f45ce52d57f (patch) | |
tree | abd596430fda45c4aa97b375678755a8106c627d /main.c | |
parent | 15c8f51a4762acf9e8cbf476f01be6b6af66caaa (diff) | |
download | qboot-630ddf38a2a32179c87656d3e1b80f45ce52d57f.zip qboot-630ddf38a2a32179c87656d3e1b80f45ce52d57f.tar.gz qboot-630ddf38a2a32179c87656d3e1b80f45ce52d57f.tar.bz2 |
fix KVM e820 and initrd
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -89,12 +89,16 @@ static void setup_idt(void) set_realmode_int(0x15, bios_int15); } +/* Top of memory below 4GB. */ +uint32_t lowmem; + static void extract_e820(void) { int id = fw_cfg_file_id("etc/e820"); uint32_t size; int nr_map; struct e820map *e820; + int i; if (id == -1) panic(); @@ -114,8 +118,13 @@ static void extract_e820(void) e820->map[3] = (struct e820entry) { .addr = 0xf0000, .size = 64 * 1024, .type = E820_RESERVED }; /* firmware */ fw_cfg_read(&e820->map[4], size); - e820->map[4].addr = 1024 * 1024; - e820->map[4].size -= 1024 * 1024; + for (i = 4; i < e820->nr_map; i++) + if (e820->map[i].addr == 0) { + lowmem = e820->map[i].size; + e820->map[i].addr = 1024 * 1024; + e820->map[i].size -= 1024 * 1024; + break; + } e820_seg = ((uintptr_t) e820) >> 4; } |