X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=hw%2Fpc.c;h=d0fcb0f4c69dd97f49ec8dd2485e4182758e5292;hb=41b9be476c2dc17dfb5182a829873644e981f9bc;hp=5431a41ac38c90452049b4bb2d9232383761c644;hpb=67b915a5dd52a05f8030cd9edc005effd9c8eea5;p=qemu diff --git a/hw/pc.c b/hw/pc.c index 5431a41..d0fcb0f 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -76,6 +76,10 @@ static void cmos_init(int ram_size, int boot_device) /* various important CMOS locations needed by PC/Bochs bios */ /* memory size */ + val = 640; /* base memory in K */ + rtc_set_memory(s, 0x15, val); + rtc_set_memory(s, 0x16, val >> 8); + val = (ram_size / 1024) - 1024; if (val > 65535) val = 65535; @@ -177,6 +181,17 @@ static uint32_t speaker_ioport_read(void *opaque, uint32_t addr) (dummy_refresh_clock << 4); } +static void ioport92_write(void *opaque, uint32_t addr, uint32_t val) +{ + cpu_x86_set_a20(cpu_single_env, (val >> 1) & 1); + /* XXX: bit 0 is fast reset */ +} + +static uint32_t ioport92_read(void *opaque, uint32_t addr) +{ + return ((cpu_single_env->a20_mask >> 20) & 1) << 1; +} + /***********************************************************/ /* Bochs BIOS debug ports */ @@ -291,12 +306,14 @@ void pc_init(int ram_size, int vga_ram_size, int boot_device, /* setup basic memory access */ cpu_register_physical_memory(0xc0000, 0x10000, 0xc0000 | IO_MEM_ROM); + cpu_register_physical_memory(0xd0000, 0x20000, IO_MEM_UNASSIGNED); cpu_register_physical_memory(0xf0000, 0x10000, 0xf0000 | IO_MEM_ROM); bochs_bios_init(); if (linux_boot) { uint8_t bootsect[512]; + uint8_t old_bootsect[512]; if (bs_table[0] == NULL) { fprintf(stderr, "A disk image must be given for 'hda' when booting a Linux kernel\n"); @@ -310,6 +327,11 @@ void pc_init(int ram_size, int vga_ram_size, int boot_device, exit(1); } + if (bdrv_read(bs_table[0], 0, old_bootsect, 1) >= 0) { + /* copy the MSDOS partition table */ + memcpy(bootsect + 0x1be, old_bootsect + 0x1be, 0x40); + } + bdrv_set_boot_sector(bs_table[0], bootsect, sizeof(bootsect)); /* now we can load the kernel */ @@ -355,6 +377,9 @@ void pc_init(int ram_size, int vga_ram_size, int boot_device, register_ioport_read(0x61, 1, 1, speaker_ioport_read, NULL); register_ioport_write(0x61, 1, 1, speaker_ioport_write, NULL); + register_ioport_read(0x92, 1, 1, ioport92_read, NULL); + register_ioport_write(0x92, 1, 1, ioport92_write, NULL); + pic_init(); pit_init(0x40, 0);