2005-02-15 Yoshinori K. Okuji <okuji@enbug.org>

* include/grub/normal.h (grub_halt_init): New prototype.
  (grub_halt_fini): Likewise.
  (grub_reboot_init): Likewise.
  (grub_reboot_fini): Likewise.

  * util/grub-emu.c: Include signal.h.
  (main_env): New global variable.
  (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot
  catch C-c.
  (grub_machine_fini): New function.
  (main): Call grub_halt_init and grub_reboot_init before
  grub_main, and grub_reboot_fini and grub_halt_fini after it.
  Call setjmp with MAIN_ENV to go back afterwards.
  Call grub_machine_fini right before return.

  * include/grub/util/misc.h: Include setjmp.h.
  (main_env): New prototype.

  * include/grub/kernel.h (grub_machine_fini): New prototype.
  * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise.
  * include/grub/i386/pc/console.h (grub_console_fini): Likewise.

  * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function.
  * kern/i386/pc/init.c (grub_machine_fini): Likewise.
  * term/i386/pc/console.c (grub_console_fini): Likewise.

  * util/i386/pc/misc.c: New file.

  * conf/i386-pc.rmk (grub_emu_SOURCES): Added
  util/i386/pc/misc.c, commands/i386/pc/halt.c and
  commands/i386/pc/reboot.c.
This commit is contained in:
okuji 2005-02-15 00:07:01 +00:00
parent c642636f8a
commit e6b92c8afb
15 changed files with 464 additions and 257 deletions

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
* Copyright (C) 2002,2005 Free Software Foundation, Inc.
*
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -43,5 +43,6 @@ int grub_biosdisk_get_diskinfo_standard (int drive,
int grub_biosdisk_get_num_floppies (void);
void grub_biosdisk_init (void);
void grub_biosdisk_fini (void);
#endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
* Copyright (C) 2002,2005 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -51,6 +51,9 @@ void grub_console_setcursor (int on);
/* Initialize the console system. */
void grub_console_init (void);
/* Finish the console system. */
void grub_console_fini (void);
#endif
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */

View file

@ -52,6 +52,9 @@ void grub_main (void);
/* The machine-specific initialization. This must initialize memory. */
void grub_machine_init (void);
/* The machine-specific finalization. */
void grub_machine_fini (void);
/* Register all the exported symbols. This is automatically generated. */
void grub_register_exported_symbols (void);

View file

@ -122,6 +122,7 @@ extern grub_jmp_buf grub_exit_env;
void grub_enter_normal_mode (const char *config);
void grub_normal_execute (const char *config, int nested);
void grub_menu_run (grub_menu_t menu, int nested);
void grub_menu_entry_run (grub_menu_entry_t entry);
void grub_cmdline_run (int nested);
int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
int echo_char, int readline);
@ -163,6 +164,10 @@ void grub_loop_init (void);
void grub_loop_fini (void);
void grub_help_init (void);
void grub_help_fini (void);
void grub_halt_init (void);
void grub_halt_fini (void);
void grub_reboot_init (void);
void grub_reboot_fini (void);
#endif
#endif /* ! GRUB_NORMAL_HEADER */

View file

@ -22,9 +22,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <setjmp.h>
extern char *progname;
extern int verbosity;
extern jmp_buf main_env;
void grub_util_info (const char *fmt, ...);
void grub_util_error (const char *fmt, ...) __attribute__ ((noreturn));