On Friday 04 Jul 2003 6:35 am, Timothy Baldwin wrote: > On Tuesday 01 Jul 2003 9:34 am, Tobias Wollgam wrote: > > Hello. > > > > Is it possible to return from GRUB to BIOS to continue its boot > > sequence? > > I have half implemented this, and will finish it off in a week, after I > return from a conference in London.
This patch should work. -- Member AFFS, WYLUG, SWP (UK), ANL, Leeds SA, Leeds Anti-war coalition OpenPGP key fingerprint: D0A6 F403 9745 CED4 6B3B 94CC 8D74 8FC9 9F7F CFE4 No to software patents! No to DRM/EUCD - hands off our computers!
? diffs
? docs/kernel
Index: docs/grub.texi
===================================================================
RCS file: /cvsroot/grub/grub/docs/grub.texi,v
retrieving revision 1.70
diff -u -b -r1.70 grub.texi
--- docs/grub.texi 9 Jun 2003 22:22:36 -0000 1.70
+++ docs/grub.texi 19 Jul 2003 12:08:21 -0000
@@ -2397,7 +2397,7 @@
* module:: Load a module
* modulenounzip:: Load a module without decompression
* pause:: Wait for a key press
-* quit:: Exit from the grub shell
+* quit:: Exit from grub
* reboot:: Reboot your computer
* read:: Read data from memory
* root:: Set GRUB's root device
@@ -2807,8 +2807,9 @@
@subsection quit
@deffn Command quit
-Exit from the grub shell @command{grub} (@pxref{Invoking the grub
-shell}). This command can be used only in the grub shell.
+Either exit from the grub shell @command{grub} (@pxref{Invoking the grub
+shell}), or exit from grub and return to the BIOS, which may try booting
+another device.
@end deffn
Index: grub/asmstub.c
===================================================================
RCS file: /cvsroot/grub/grub/grub/asmstub.c,v
retrieving revision 1.78
diff -u -b -r1.78 asmstub.c
--- grub/asmstub.c 3 Dec 2002 00:02:53 -0000 1.78
+++ grub/asmstub.c 19 Jul 2003 12:08:25 -0000
@@ -261,6 +261,12 @@
}
void
+quit (void)
+{
+ stop ();
+}
+
+void
grub_reboot (void)
{
stop ();
Index: stage1/stage1.S
===================================================================
RCS file: /cvsroot/grub/grub/stage1/stage1.S,v
retrieving revision 1.34
diff -u -b -r1.34 stage1.S
--- stage1/stage1.S 10 Dec 2002 17:30:28 -0000 1.34
+++ stage1/stage1.S 19 Jul 2003 12:08:26 -0000
@@ -238,7 +238,8 @@
jz floppy_probe
/* Nope, we definitely have a hard disk, and we're screwed. */
- jmp hd_probe_error
+ movw $ABS(hd_probe_error_string), %si
+ jmp general_error
final_init:
@@ -373,27 +374,23 @@
* BIOS Geometry translation error (past the end of the disk geometry!).
*/
geometry_error:
- MSG(geometry_error_string)
+ movw $ABS(geometry_error_string), %si
jmp general_error
-/*
- * Disk probe failure.
- */
-hd_probe_error:
- MSG(hd_probe_error_string)
- jmp general_error
/*
* Read error on the disk.
*/
read_error:
- MSG(read_error_string)
+ movw $ABS(read_error_string), %si
general_error:
+ call message
MSG(general_error_string)
-/* go here when you need to stop the machine hard after an error condition */
-stop: jmp stop
+/* go here when you need to return to BIOS after an error condition */
+stop: int $0x18
+ jmp stop
notification_string: .string "GRUB "
geometry_error_string: .string "Geom"
@@ -466,7 +463,7 @@
/*
* Floppy disk probe failure.
*/
- MSG(fd_probe_error_string)
+ movw $ABS(fd_probe_error_string), %si
jmp general_error
fd_probe_error_string: .string "Floppy"
Index: stage2/asm.S
===================================================================
RCS file: /cvsroot/grub/grub/stage2/asm.S,v
retrieving revision 1.66
diff -u -b -r1.66 asm.S
--- stage2/asm.S 21 Dec 2002 00:34:33 -0000 1.66
+++ stage2/asm.S 19 Jul 2003 12:08:31 -0000
@@ -116,7 +116,6 @@
/* set up %ds, %ss, and %es */
xorw %ax, %ax
movw %ax, %ds
- movw %ax, %ss
movw %ax, %es
#ifndef SUPPORT_DISKLESS
@@ -127,7 +126,14 @@
ADDR32 movl %ebp, EXT_C(install_second_sector)
#endif
+#ifdef SUPPORT_DISKLESS
+ /* save BIOS stack */
+ movw %ss, bios_stack_segment
+ movw %sp, bios_stack_pointer
+#endif
+
/* set up the real mode/BIOS stack */
+ movw %ax, %ss
movl $STACKOFF, %ebp
movl %ebp, %esp
@@ -203,6 +209,27 @@
hlt
jmp EXT_C(hard_stop)
+ENTRY(error_stop)
+ENTRY(quit)
+ call EXT_C(prot_to_real)
+.code16
+#ifdef SUPPORT_DISKLESS
+ cli
+ nop
+ movw bios_stack_segment, %ss
+ movw bios_stack_pointer, %sp
+ sti
+ lret
+bios_stack_segment:
+ .word 0
+bios_stack_pointer:
+ .word 0
+#else
+ int $0x18
+ jmp hard_stop
+#endif
+.code32
+
#ifndef STAGE1_5
/*
* stop_floppy()
Index: stage2/builtins.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/builtins.c,v
retrieving revision 1.143
diff -u -b -r1.143 builtins.c
--- stage2/builtins.c 10 Mar 2003 01:12:26 -0000 1.143
+++ stage2/builtins.c 19 Jul 2003 12:08:44 -0000
@@ -2946,12 +2946,11 @@
};
-#ifdef GRUB_UTIL
/* quit */
static int
quit_func (char *arg, int flags)
{
- stop ();
+ quit ();
/* Never reach here. */
return 0;
@@ -2963,9 +2962,12 @@
quit_func,
BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
"quit",
+#ifdef GRUB_UTIL
"Exit from the GRUB shell."
-};
+#else
+ "Exit from GRUB, and return to BIOS."
#endif /* GRUB_UTIL */
+};
#ifdef SUPPORT_NETBOOT
@@ -4719,9 +4721,7 @@
&builtin_parttype,
&builtin_password,
&builtin_pause,
-#ifdef GRUB_UTIL
&builtin_quit,
-#endif /* GRUB_UTIL */
#ifdef SUPPORT_NETBOOT
&builtin_rarp,
#endif /* SUPPORT_NETBOOT */
Index: stage2/nbloader.S
===================================================================
RCS file: /cvsroot/grub/grub/stage2/nbloader.S,v
retrieving revision 1.3
diff -u -b -r1.3 nbloader.S
--- stage2/nbloader.S 15 Aug 2000 10:08:21 -0000 1.3
+++ stage2/nbloader.S 19 Jul 2003 12:08:44 -0000
@@ -114,7 +114,11 @@
/* Jump to the stage2 */
boot_stage2:
- ljmp $0, $STAGE2_START_ADDR
+ lcall $0, $STAGE2_START_ADDR
+ int $0x18
+stop:
+ hlt
+ jmp stop
/* This ensures that the length of this image will be 1 sector */
. = _start + 0x200 - 1
Index: stage2/shared.h
===================================================================
RCS file: /cvsroot/grub/grub/stage2/shared.h,v
retrieving revision 1.93
diff -u -b -r1.93 shared.h
--- stage2/shared.h 18 Mar 2003 23:51:59 -0000 1.93
+++ stage2/shared.h 19 Jul 2003 12:08:48 -0000
@@ -678,8 +678,14 @@
/* Enter the stage1.5/stage2 C code after the stack is set up. */
void cmain (void);
-/* Halt the processor (called after an unrecoverable error). */
+/* Halt the processor. */
void stop (void) __attribute__ ((noreturn));
+
+/* Return to BIOS. */
+void quit (void) __attribute__ ((noreturn));
+
+/* Halt the processor or return to BIOS (called after an unrecoverable error). */
+void error_stop (void) __attribute__ ((noreturn));
/* Reboot the system. */
void grub_reboot (void) __attribute__ ((noreturn));
Index: stage2/stage1_5.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/stage1_5.c,v
retrieving revision 1.7
diff -u -b -r1.7 stage1_5.c
--- stage2/stage1_5.c 7 Feb 2002 23:28:47 -0000 1.7
+++ stage2/stage1_5.c 19 Jul 2003 12:08:48 -0000
@@ -48,7 +48,7 @@
if (saved_sector == -1)
{
grub_printf ("internal error: the second sector of Stage 2 is unknown.");
- stop ();
+ error_stop ();
}
ret = grub_read ((char *) 0x8000 + SECTOR_SIZE * 2, -1);
@@ -65,5 +65,5 @@
print_error ();
- stop ();
+ error_stop ();
}
Index: stage2/stage2.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/stage2.c,v
retrieving revision 1.42
diff -u -b -r1.42 stage2.c
--- stage2/stage2.c 4 Dec 2002 00:55:45 -0000 1.42
+++ stage2/stage2.c 19 Jul 2003 12:08:50 -0000
@@ -319,7 +319,8 @@
if (config_entries)
printf ("\
Press enter to boot the selected OS, \'e\' to edit the\n\
- commands before booting, or \'c\' for a command-line.");
+ commands before booting, \'c\' for a command-line, or \'q\'\n\
+ to return to BIOS and boot the next IPL device.");
else
printf ("\
Press \'b\' to boot, \'e\' to edit the selected command in the\n\
@@ -697,13 +698,10 @@
enter_cmdline (heap, 0);
goto restart;
}
-#ifdef GRUB_UTIL
if (c == 'q')
{
- /* The same as ``quit''. */
- stop ();
+ quit ();
}
-#endif
}
}
}
Index: stage2/start.S
===================================================================
RCS file: /cvsroot/grub/grub/stage2/start.S,v
retrieving revision 1.8
diff -u -b -r1.8 start.S
--- stage2/start.S 30 Dec 2001 08:23:16 -0000 1.8
+++ stage2/start.S 19 Jul 2003 12:08:51 -0000
@@ -335,8 +335,10 @@
general_error:
MSG(general_error_string)
-/* go here when you need to stop the machine hard after an error condition */
-stop: jmp stop
+/* go here when you need to return to BIOS after an error condition */
+stop: int $0x18
+ hlt
+ jmp stop
#ifdef STAGE1_5
notification_string: .string "Loading stage1.5"
pgp00000.pgp
Description: signature
_______________________________________________ Bug-grub mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-grub
