Misc minor improvements.
[seabios.git] / src / boot.c
index 09d28e8a9ae43416be357ed65a1bd2e44bcbbc63..1b5c3d8a9dcbe6bf8ef03857d47c2ae1b14cdab9 100644 (file)
@@ -1,4 +1,4 @@
-// 16bit code to load disk image and start system boot.
+// Code to load disk image and start system boot.
 //
 // Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
 // Copyright (C) 2002  MandrakeSoft S.A.
@@ -6,15 +6,11 @@
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
 #include "util.h" // irq_enable
-#include "biosvar.h" // struct bregs
+#include "biosvar.h" // GET_EBDA
 #include "config.h" // CONFIG_*
 #include "ata.h" // ata_detect
 #include "disk.h" // cdrom_boot
-
-// We need a copy of this string, but we are not actually a PnP BIOS,
-// so make sure it is *not* aligned, so OSes will not see it if they
-// scan.
-char pnp_string[] VISIBLE16 __attribute__((aligned (2))) = " $PnP";
+#include "bregs.h" // struct bregs
 
 //--------------------------------------------------------------------------
 // print_boot_device
@@ -81,7 +77,8 @@ print_boot_failure(u16 type, u8 reason)
 static void
 try_boot(u16 seq_nr)
 {
-    irq_enable();
+    if (! CONFIG_BOOT)
+        BX_PANIC("Boot support not compiled in.\n");
 
     SET_EBDA(ipl.sequence, seq_nr);
 
@@ -110,8 +107,8 @@ try_boot(u16 seq_nr)
     u8 bootdrv = 0;
     struct bregs cr;
     switch(type) {
-    case IPL_TYPE_FLOPPY: /* FDD */
-    case IPL_TYPE_HARDDISK: /* HDD */
+    case IPL_TYPE_FLOPPY:
+    case IPL_TYPE_HARDDISK:
 
         bootdrv = (type == IPL_TYPE_HARDDISK) ? 0x80 : 0x00;
         bootseg = 0x07c0;
@@ -147,7 +144,7 @@ try_boot(u16 seq_nr)
         /* CD-ROM */
         if (! CONFIG_CDROM_BOOT)
             break;
-        u16 status = cdrom_boot();
+        int status = cdrom_boot();
         if (status) {
             printf("CDROM boot failure code : %04x\n", status);
             print_boot_failure(type, 1);
@@ -197,18 +194,24 @@ do_boot(u16 seq_nr)
 }
 
 // Boot Failure recovery: try the next device.
-void VISIBLE16
+void VISIBLE32
 handle_18()
 {
+    debug_serial_setup();
     debug_enter(NULL, DEBUG_HDL_18);
     u16 seq = GET_EBDA(ipl.sequence) + 1;
     do_boot(seq);
 }
 
 // INT 19h Boot Load Service Entry Point
-void VISIBLE16
+void VISIBLE32
 handle_19()
 {
+    debug_serial_setup();
     debug_enter(NULL, DEBUG_HDL_19);
     do_boot(0);
 }
+
+// Ughh - some older gcc compilers have a bug which causes VISIBLE32
+// functions to not be exported as global variables.
+asm(".global handle_18, handle_19");