Revision 8ca209ad hw/pc.c

b/hw/pc.c
467 467

  
468 468
int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
469 469
{
470
    int index = e820_table.count;
470
    int index = le32_to_cpu(e820_table.count);
471 471
    struct e820_entry *entry;
472 472

  
473 473
    if (index >= E820_NR_ENTRIES)
474 474
        return -EBUSY;
475
    entry = &e820_table.entry[index];
475
    entry = &e820_table.entry[index++];
476 476

  
477
    entry->address = address;
478
    entry->length = length;
479
    entry->type = type;
477
    entry->address = cpu_to_le64(address);
478
    entry->length = cpu_to_le64(length);
479
    entry->type = cpu_to_le32(type);
480 480

  
481
    e820_table.count++;
482
    return e820_table.count;
481
    e820_table.count = cpu_to_le32(index);
482
    return index;
483 483
}
484 484

  
485 485
static void *bochs_bios_init(void)

Also available in: Unified diff