//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "util.h" // irq_enable
+#include "util.h" // dprintf
#include "biosvar.h" // GET_EBDA
#include "config.h" // CONFIG_*
#include "disk.h" // cdrom_boot
#include "bregs.h" // struct bregs
#include "boot.h" // struct ipl_s
#include "cmos.h" // inb_cmos
+#include "paravirt.h"
struct ipl_s IPL;
// Add a bcv entry for an internal harddrive
void
-add_bcv_internal(int driveid)
+add_bcv_internal(struct drive_s *drive_g)
{
if (! CONFIG_BOOT)
return;
return;
struct ipl_entry_s *ie = &IPL.bcv[IPL.bcvcount++];
+ if (CONFIG_THREADS) {
+ // Add to bcv list with assured drive order.
+ struct ipl_entry_s *end = ie;
+ for (;;) {
+ struct ipl_entry_s *prev = ie - 1;
+ if (prev < IPL.bcv || prev->type != BCV_TYPE_INTERNAL)
+ break;
+ struct drive_s *prevdrive = (void*)prev->vector;
+ if (prevdrive->type < drive_g->type
+ || (prevdrive->type == drive_g->type
+ && prevdrive->cntl_id < drive_g->cntl_id))
+ break;
+ ie--;
+ }
+ if (ie != end)
+ memmove(ie+1, ie, (void*)end-(void*)ie);
+ }
ie->type = BCV_TYPE_INTERNAL;
- ie->vector = driveid;
+ ie->vector = (u32)drive_g;
ie->description = "";
}
{
int i;
for (i = 0; i < Drives.floppycount; i++) {
- int driveid = Drives.idmap[EXTTYPE_FLOPPY][i];
+ struct drive_s *drive_g = getDrive(EXTTYPE_FLOPPY, i);
printf("%d. Floppy [", menupos + i);
- describe_drive(driveid);
+ describe_drive(drive_g);
printf("]\n");
}
return Drives.floppycount;
switch (ie->type) {
case BCV_TYPE_INTERNAL:
printf("%d. ", menupos + i);
- describe_drive(ie->vector);
+ describe_drive((void*)ie->vector);
printf("\n");
break;
default:
{
int i;
for (i = 0; i < Drives.cdcount; i++) {
- int driveid = Drives.idmap[EXTTYPE_CD][i];
+ struct drive_s *drive_g = getDrive(EXTTYPE_CD, i);
printf("%d. CD-Rom [", menupos + i);
- describe_drive(driveid);
+ describe_drive(drive_g);
printf("]\n");
}
return Drives.cdcount;
static void
interactive_bootmenu()
{
- if (! CONFIG_BOOTMENU)
+ if (! CONFIG_BOOTMENU || ! qemu_cfg_show_boot_menu())
return;
while (get_keystroke(0) >= 0)
{
switch (ie->type) {
case BCV_TYPE_INTERNAL:
- map_hd_drive(ie->vector);
+ map_hd_drive((void*)ie->vector);
break;
case BCV_TYPE_EXTERNAL:
call_bcv(ie->vector >> 16, ie->vector & 0xffff);
if (! CONFIG_BOOT)
return;
+ // XXX - show available drives?
+
// Allow user to modify BCV/IPL order.
interactive_bootmenu();
struct bregs br;
memset(&br, 0, sizeof(br));
+ br.flags = F_IF;
br.code = SEGOFF(bootseg, bootip);
// Set the magic number in ax and the boot drive in dl.
br.dl = bootdrv;
// Read sector
struct bregs br;
memset(&br, 0, sizeof(br));
+ br.flags = F_IF;
br.dl = bootdrv;
br.es = bootseg;
br.ah = 2;
printf("No bootable device.\n");
// Loop with irqs enabled - this allows ctrl+alt+delete to work.
for (;;)
- usleep(1000000);
+ biosusleep(1000000);
}
/* Do the loading, and set up vector as a far pointer to the boot
// Boot failed: invoke the boot recovery function
struct bregs br;
memset(&br, 0, sizeof(br));
+ br.flags = F_IF;
call16_int(0x18, &br);
}