Support multiple fallback entries, and provide an API to support
executing default+fallback menu entries. Renamed the `terminal' menu
viewer to `text'.
* include/grub/normal.h (grub_normal_text_menu_viewer): New global
variable declaration.
(grub_menu_execute_callback): New structure declaration.
(grub_menu_execute_callback_t): New typedef.
(grub_menu_execute_with_fallback): New function declaration.
(grub_menu_get_entry): Likewise.
(grub_menu_get_timeout): Likewise.
(grub_menu_set_timeout): Likewise.
* normal/main.c (GRUB_MOD_INIT(normal)): Refer to new variable name.
* normal/menu.c (grub_wait_after_message): Moved to
`normal/menu_text.c'.
(draw_border): Likewise.
(print_message): Likewise.
(print_entry): Likewise.
(print_entries): Likewise.
(grub_menu_init_page): Likewise.
(get_entry_number): Likewise.
(print_timeout): Likewise.
(run_menu): Likewise.
(grub_menu_execute_entry): Likewise.
(show_text_menu): Likewise.
(get_and_remove_first_entry_number): New function.
(grub_menu_execute_with_fallback): Likewise.
(get_entry): Renamed to ...
(grub_menu_get_entry): .. this and made it global.
(get_timeout): Renamed to ...
(grub_menu_get_timeout): ... this and made it global.
(set_timeout): Renamed to ...
(grub_menu_set_timeout): ... this and made it global.
(grub_normal_terminal_menu_viewer): Renamed to ...
(grub_normal_text_menu_viewer): ... this.
* normal/menu_text.c: New file. Extracted text-menu-specific code
from normal/menu.c.
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add `normal/menu_text.c'.
(normal_mod_SOURCES): Likewise.
* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/i386-pc.rmk, (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* normal/main.c: Add include to grub/menu_viewer.h.
(free_menu_entry_classes): Added.
(grub_normal_menu_addentry): Added class property handling.
(grub_normal_execute): Changed to use new menu viewer for menu viewing.
(GRUB_MOD_INIT(normal)): Added register for text based menu viewer.
* normal/menu_viewer.c: New file.
* normal/menu.c (run_menu_entry): Renamed to ...
(grub_menu_execute_entry): ... this and made it as global.
(grub_menu_run): Renamed to ...
(show_text_menu): ... this and made it local.
(show_text_menu): Adapt to new function names.
(grub_normal_terminal_menu_viewer): New global variable.
* include/grub/menu.h: New file.
* include/grub/menu_viewer.h: New file.
* include/grub/normal.h: Added include to grub/menu.h.
(grub_menu_entry): Moved to include/grub/menu.h.
(grub_menu_entry_t): Likewise.
(grub_menu): Likewise.
(grub_menu_t): Likewise.
(grub_normal_terminal_menu_viewer): Added.
(grub_menu_execute_entry): Likewise.
(grub_menu_run): Removed.
* DISTLIST: Added include/grub/menu.h.
Added include/grub/menu_viewer.h.
Added normal/menu_viewer.c.
2009-01-31 Vesa Jääskeläinen <chaac@nic.fi>
* normal/execute.c (grub_script_execute_menuentry): Changed to use
arglist for menutitle arguments.
* normal/main.c (grub_normal_menu_addentry): Likewise.
* normal/parser.y (menuentry): Likewise.
* normal/script.c (grub_script_create_cmdmenu): Likewise.
* include/grub/script.h (grub_script_cmd_menuentry): Likewise.
(grub_script_create_cmdmenu): Likewise.
* include/grub/normal.h (grub_normal_menu_addentry): Likewise.
* conf/i386-pc.rmk (normal_mod_SOURCES): Adapt Colin D Bennett's
changes.
* conf/x86_64-efi.rmk (normal_mod_SOURCES): Likewise.
* conf/i386-coreboot.rmk (normal_mod_SOURCES): Likewise.
* conf/i386-efi.rmk (normal_mod_SOURCES): Likewise.
* conf/i386-ieee1275.rmk (normal_mod_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (normal_mod_SOURCES): Likewise.
* conf/sparc64-ieee1275.rmk (normal_mod_SOURCES): Likewise.
* kern/disk.c: Replace `<grub/machine/time.h>' with `<grub/time.h>'.
(grub_last_time): Change type to grub_uint64_t.
(grub_disk_open): Migrate code from to using grub_get_time_ms().
(grub_disk_close): Likewise.
* normal/menu.c: Replace `<grub/machine/time.h>' with `<grub/time.h>'.
(run_menu): Migrate code from to using grub_get_time_ms().
* util/misc.c (grub_get_time_ms): New function.
* normal/menu.c (run_menu): Move timeout message from here ...
(print_timeout): ... to here.
(run_menu): Use print_timeout() once during initial draw to print
the whole message, and again in every clock tick to update only
the number of seconds.
* include/grub/normal.h (grub_env_write_color_normal): New prototype.
(grub_env_write_color_highlight): Likewise.
(grub_wait_after_message): Likewise.
* normal/color.c: New file.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* conf/i386-efi.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* conf/i386-linuxbios.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* normal/menu_entry.c (run): Rely on grub_wait_after_message()
for waiting after a message is printed.
* normal/main.c (read_config_file): Likewise.
(grub_normal_init): Register grub_env_write_color_normal() and
grub_env_write_color_highlight() hooks. Mark `color_normal' and
`color_highlight' variables as global.
* normal/menu.c (grub_wait_after_message): New function.
(grub_color_menu_normal): New variable. Replaces ...
(GRUB_COLOR_MENU_NORMAL): ... this macro.
(grub_color_menu_highlight): New variable. Replaces ...
(GRUB_COLOR_MENU_HIGHLIGHT): ... this macro.
(draw_border): Set color state to `GRUB_TERM_COLOR_NORMAL' instead of
`GRUB_TERM_COLOR_STANDARD'.
(print_message): Use `grub_setcolorstate' to reload colors. Rename
`normal_code' and `highlight_code' to `old_color_normal' and
`old_color_highlight', respectively.
(grub_menu_init_page): Update colors when drawing the menu, based on
`menu_color_normal' and `menu_color_highlight' variables.
(grub_menu_run): Rely on grub_wait_after_message() for waiting after
a message is printed.
* include/grub/term.h (struct grub_term): Add `getcolor' function.
(grub_getcolor): New function.
* kern/term.c (grub_getcolor): New function.
* normal/menu.c (GRUB_COLOR_MENU_NORMAL): New macro.
(GRUB_COLOR_MENU_HIGHLIGHT): New macro.
(print_entry): Set normal and highlight colors to
`GRUB_COLOR_MENU_NORMAL' and `GRUB_COLOR_MENU_HIGHLIGHT',
respectively, before printing and restore them to old
values afterwards.
(grub_menu_init_page): Likewise. Fill an additional colored space
that would otherwise be left blank.
* term/efi/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/ieee1275/ofconsole.c (grub_ofconsole_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/serial.c (grub_serial_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vesafb.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vga.c (grub_vga_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/gfxterm.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
Use the environment context in the menu. Remove the commands
"default" and "timeout", and use variables instead.
* normal/menu.c: Include grub/env.h.
(print_entry): Cast TITLE to silence gcc.
(get_timeout): New function.
(set_timeout): Likewise.
(get_entry_number): Likewise.
(run_menu): Use a default entry, a fallback entry and a timeout
in the environment variables "default", "fallback" and
"timeout". Also, tweak the default entry if it is not within the
current menu entries.
(grub_menu_run): Use a fallback entry in the environment variable
"fallback".
* normal/main.c (read_config_file): Do not initialize
NEWMENU->DEFAULT_ENTRY, NEWMENU->FALLBACK_ENTRY or
NEWMENU->TIMEOUT.
(grub_normal_execute): Use a data slot to store the menu.
* include/grub/normal.h (struct grub_menu): Removed default_entry,
fallback_entry and timeout.
(struct grub_menu_list): Removed.
(grub_menu_list_t): Likewise.
(struct grub_context): Likewise.
(grub_context_t): Likewise.
(grub_context_get): Likewise.
(grub_context_get_current_menu): Likewise.
(grub_context_push_menu): Likewise.
(grub_context_pop_menu): Likewise.
(grub_default_init): Likewise.
(grub_default_fini): Likewise.
(grub_timeout_init): Likewise.
(grub_timeout_fini): Likewise.
* conf/sparc64-ieee1275.rmk (pkgdata_MODULES): Removed default.mod
and timeout.mod.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Removed
commands/default.c, commands/timeout.c and normal/context.c.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/i386-pc.rmk (grub_emu_SOURCES): Removed commands/default.c,
commands/timeout.c and normal/context.c.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/i386-efi.rmk (grub_emu_SOURCES): Removed
commands/default.c, commands/timeout.c and normal/context.c.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/common.rmk (pkgdata_MODULES): Removed default.mod and
timeout.mod.
(default_mod_SOURCES): Removed.
(default_mod_CFLAGS): Likewise.
(default_mod_LDFLAGS): Likewise.
(timeout_mod_SOURCES): Removed.
(timeout_mod_CFLAGS): Likewise.
(timeout_mod_LDFLAGS): Likewise.
* DISTLIST: Removed commands/default.c, commands/timeout.c and
normal/context.c.
* commands/default.c: Removed.
* commands/timeout.c: Likewise.
* normal/context.c: Likewise.
* include/grub/normal.h: Include <grub/script.h>.
(grub_command_list): Removed struct.
(grub_command_list_t): Removed type.
(grub_menu_entry): Remove members `num' and `command_list'. Add
members `commands' and `sourcecode'.
* include/grub/script.h: Add inclusion guards.
(grub_script_cmd_menuentry): New struct.
(grub_script_execute_menuentry): New prototype.
(grub_script_lexer_record_start): Likewise.
(grub_script_lexer_record_stop): Likewise.
* normal/execute.c (grub_script_execute_menuentry): New function.
* normal/lexer.c (record, recording, recordpos, recordlen): New
variables.
(grub_script_lexer_record_start): New function.
(grub_script_lexer_record_stop): Likewise.
(recordchar): Likewise.
(nextchar): Likewise.
(grub_script_yylex): Use `nextchar' to fetch new characters. Use
2048 as the buffer size. Add the tokens `menuentry' and `@'.
* normal/main.c: Include <grub/parser.h> and <grub/script.h>
(current_menu): New variable.
(free_menu): Mainly rewritten.
(grub_normal_menu_addentry): New function.
(read_config_file): Rewritten.
* normal/menu.c (run_menu_entry): Mainly rewritten.
* normal/menu_entry.c (make_screen): Rewritten te code to insert
the menu entry.
(run): Mainly rewritten.
* normal/parser.y (menu_entry): New variable.
(GRUB_PARSER_TOKEN_MENUENTRY): New token.
(menuentry): New rule.
(command): Add `menuentry'.
(if_statement): Allow additional returns before `fi'.
* normal/script.c (grub_script_create_cmdmenu): New function.
* util/console.c (grub_ncurses_putchar): If C is greater than
0x7f, set C to a question mark.
(grub_ncurses_getcharwidth): New function.
(grub_ncurses_term): Specify grub_ncurses_getcharwidth as
getcharwidth.
* normal/menu.c (print_entry): Made aware of Unicode. First,
convert TITLE to UCS-4, and predict the cursor position by
grub_getcharwidth.
* include/grub/misc.h (grub_utf8_to_ucs4): Specify the qualifier
const to SRC.
* kern/misc.c (grub_utf16_to_utf8): Likewise.
* normal/menu.c (run_menu_entry):
* normal/command.c (grub_command_execute): If INTERACTIVE is
false and GRUB_COMMAND_FLAG_NO_ECHO is not specified, print
CMDLINE. Disable the pager if INTERACTIVE is true.
All callers are changed.
* normal/main.c (grub_normal_execute): Read command.lst and fs.lst
before reading a config file.
* normal/main.c (read_config_file): Even if a command is not
found, register it if it is within an entry.
* util/grub-emu.c: Include sys/types.h and unistd.h.
(options): Added --hold.
(struct arguments): Added a new member "hold".
(parse_opt): If KEY is 'H', set ARGS->HOLD to ARG or -1 if ARG is
missing.
(main): Initialize ARGS.HOLD to zero. Wait until ARGS.HOLD is
cleared by a debugger, if it is not zero.
* include/grub/normal.h (grub_command_execute): Add an argument
INTERACTIVE.
* DISTLIST: Added normal/completion.c.
* normal/completion.c: New file.
* term/i386/pc/console.c (grub_console_getwh): New function.
(grub_console_term): Assign grub_console_getwh to getwh.
* normal/cmdline.c (grub_tab_complete): Removed. Now the same
function is defined in normal/completion.c as
grub_normal_do_completion.
(grub_cmdline_get): Use grub_normal_do_completion instead of
grub_tab_complete.
* kern/partition.c (grub_partition_map_iterate): Return 1 if HOOK
returns non-zero, otherwise return 0.
(grub_partition_iterate): First, probe the partition map. Then,
call ITERATE only for this partition map.
* kern/misc.c (grub_strncmp): Rewritten.
* kern/disk.c (grub_disk_dev_iterate): Return 1 if P->ITERATE
returns non-zero. Otherwise return 0.
* include/grub/partition.h (grub_partition_map_iterate): Return
int instead of void.
* include/grub/normal.h (grub_normal_do_completion): New prototype.
* include/grub/misc.h (grub_strncmp): Change the type of N to
grub_size_t.
* include/grub/disk.h (grub_disk_dev_iterate): Return int instead
of void.
* normal/menu.c (draw_border): Cast GRUB_TERM_BORDER_WIDTH to
unsigned explictly before comparing it with I.
* kern/main.c (grub_env_write_root): Add the attribute unused into
VAR.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Added
normal/completion.c.
(normal_mod_SOURCES): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* normal/command.c (grub_iterate_commands): If ITERATE returns
non-zero, return one immediately.
* commands/default.h: New file.
* commands/timeout.h: Likewise.
* normal/context.c: Likewise.
* util/misc.c: Do not include sys/times.h.
Include sys/time.h and grub/machine/time.h.
(grub_get_rtc): Rewritten with gettimeofday.
* util/grub-emu.c (main): Call grub_default_init and
grub_timeout_init before grub_normal_init, and call
grub_timeout_fini and grub_default_fini after grub_main.
* util/console.c (grub_ncurses_checkkey): Return the read
character or -1.
* normal/menu.c (run_menu): Set MENU->TIMEOUT to -1 once it
timeouts.
* normal/main.c (read_config_file): Push MENU. If this fails,
print an error and wait for a user input.
Print an error only if GRUB_ERRNO is not GRUB_ERR_NONE.
If a menu is empty or an error occurs, pop MENU.
(grub_normal_execute): Pop and free MENU after grub_menu_run
returns.
* kern/loader.c (grub_loader_boot): Call grub_machine_fini.
* include/grub/powerpc/ieee1275/time.h [GRUB_UTIL]: Do not
include time.h.
[GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
without GRUB_UTIL.
* include/grub/i386/pc/time.h [GRUB_UTIL]: Do not include
time.h.
[GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
without GRUB_UTIL.
* include/grub/normal.h (struct grub_menu_list): New struct.
(grub_menu_list_t): New type.
(struct grub_context): New struct.
(grub_context_t): New type.
(grub_register_command): Got rid of EXPORT_FUNC.
(grub_unregister_command): Likewise.
(grub_context_get): New prototype.
(grub_context_get_current_menu): Likewise.
(grub_context_push_menu): Likewise.
(grub_context_pop_menu): Likewise.
[GRUB_UTIL] (grub_default_init): Likewise.
[GRUB_UTIL] (grub_default_fini): Likewise.
[GRUB_UTIL] (grub_timeout_init): Likewise.
[GRUB_UTIL] (grub_timeout_fini): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/default.c,
commands/timeout.c and normal/context.c.
(pkgdata_MODULES): Added default.mod and timeout.mod.
(normal_mod_SOURCES): Added normal/context.c.
(default_mod_SOURCES): New variable.
(default_mod_CFLAGS): Likewise.
(timeout_mod_SOURCES): Likewise.
(timeout_mod_CFLAGS): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Copied from
conf/i386-pc.rmk.
(pkgdata_MODULES): Added default.mod and timeout.mod.
(normal_mod_SOURCES): Added normal/context.c.
(default_mod_SOURCES): New variable.
(default_mod_CFLAGS): Likewise.
(timeout_mod_SOURCES): Likewise.
(timeout_mod_CFLAGS): Likewise.
* Makefile.in (all-local): Added $(MKFILES).
* normal/menu.c (TERM_WIDTH): Macro redefined.
(TERM_TOP_BORDER_Y): Likewise.
(draw_border): Replaced while-loop by a for-loop. Make the number
of lines consistent with the number of lines displayed in
print_entries. Added a margin below the rectangle.
(print_entry): Make the entry fit in the rectangle.
(print_entries): Display the scroll arrows next to the right
border.
Make the source code of the menu interface more readable.
* normal/menu.c: Include grub/mm.h.
(TERM_WIDTH): New macro.
(TERM_HEIGHT): Likewise.
(TERM_INFO_HEIGHT): Likewise.
(TERM_MARGIN): Likewise.
(TERM_SCROLL_WIDTH): Likewise.
(TERM_TOP_BORDER_Y): Likewise.
(TERM_LEFT_BORDER_X): Likewise.
(TERM_BORDER_WIDTH): Likewise.
(TERM_MESSAGE_HEIGHT): Likewise.
(TERM_BORDER_HEIGHT): Likewise.
(TERM_NUM_ENTRIES): Likewise.
(TERM_FIRST_ENTRY_Y): Likewise.
(TERM_ENTRY_WIDTH): Likewise.
(TERM_CURSOR_X): Likewise.
(draw_border): Use macros instead of magic numbers.
(print_entry): Likewise.
(print_entries): Likewise.
(run_menu): Likewise. Also, handle the key 'e'.
(run_menu_entry): Ignore empty command lines.
(print_message): Added a new argument EDIT. If EDIT is true,
print a different message.
(init_page): Likewise.
(edit_menu_entry): New function. Not implemented yet.
Add `linux.mod' and `multiboot.mod' so linux and multiboot kernels
can be loaded from normal mode.
* conf/i386-pc.rmk (pkgdata_MODULES): Add `linux.mod' and
`multiboot.mod'.
(linux_mod_SOURCES, linux_mod_CFLAGS, multiboot_mod_SOURCES)
(multiboot_mod_CFLAGS): New variables.
* loader/i386/pc/linux_normal.c: New file.
* loader/i386/pc/multiboot_normal.c: Likewise.
* loader/i386/pc/linux.c (grub_rescue_cmd_initrd): Don't use the
attribute `unused'.
* fs/ext2.c (grub_ext2_iterate_dir): Fix typos in inode type. Use
`fdiro' to read the mode information from instead of `diro'.
* fs/fshelp.c (grub_fshelp_find_file): Set type to foundtype after
looking up a symlink.
* include/grub/normal.h (GRUB_COMMAND_FLAG_NO_ARG_PARSE): New
macro.
* normal/command.c (grub_command_execute): Don't parse the
arguments when `GRUB_COMMAND_FLAG_NO_ARG_PARSE' is set in the
flags of the command.
* normal/menu.c (grub_menu_run): Fix typo.
* normal/menu.c: Include grub/loader.h and grub/machine/time.h.
(print_message): Add a missing newline.
(run_menu): Added timeout support.
(run_menu_entry): New local function.
(grub_menu_run): Added support for booting.
* kern/loader.c (grub_loader_is_loaded): New function.
* include/grub/powerpc/ieee1275/time.h: Include grub/symbol.h.
(grub_get_rtc): Exported.
* include/grub/i386/pc/time.h: Include grub/symbol.h.
(grub_get_rtc): Exported.
* include/grub/normal.h (struct grub_command_list): Remove
constant from the member `command'.
* include/grub/loader.h (grub_loader_is_loaded): Declared.
* include/grub/err.h (GRUB_ERR_INVALID_COMMAND): New constant.
* conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/time.h.
All symbols prefixed with PUPA_ and pupa_ are renamed to GRUB_
and grub_, respectively. Because the conversion is trivial and
mechanical, I omit the details here. Please refer to the CVS
if you need more information.
I forgot to check in these changes for a long time. This adds
incomplete support for VGA console, and this is still very
buggy. Also, a lot of consideration is required for I18N,
UNICODE, and VGA font issues. Therefore, assume that this is
such that "better than nothing".
* font/manager.c: New file.
* include/pupa/font.h: Likewise.
* include/pupa/i386/pc/vga.h: Likewise.
* term/i386/pc/vga.c: Likewise.
* util/unifont2pff.rb: Likewise.
* conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/vga.h.
(pkgdata_MODULES): Added vga.mod and font.mod.
(vga_mod_SOURCES): New variables.
(vga_mod_CFLAGS): Likewise.
(font_mod_SOURCES): Likewise.
(font_mod_CFLAGS): Likewise.
* include/pupa/err.h (PUPA_ERR_BAD_FONT): New constant.
* include/pupa/term.h: Include pupa/err.h.
(struct pupa_term): Added init and fini.
Changed the argument of putchar to pupa_uint32_t.
* include/pupa/i386/pc/console.h: Include pupa/symbol.h.
(pupa_console_real_putchar): New prototype.
(pupa_console_putchar): Removed.
(pupa_console_checkkey): Exported.
(pupa_console_getkey): Likewise.
* kern/misc.c (pupa_vsprintf): Add support for UNICODE
characters.
* kern/term.c (pupa_term_set_current): Rewritten.
(pupa_putchar): Likewise.
(pupa_putcode): New function.
* kern/i386/pc/startup.S (pupa_console_putchar): Renamed to ...
(pupa_console_real_putchar): ... this.
(pupa_vga_set_mode): New function.
(pupa_vga_get_font): Likewise.
* normal/command.c: Include pupa/term.h.
(terminal_command): New function.
(pupa_command_init): Register the command "terminal".
* normal/menu.c (DISP_LEFT): Changed to a UNICODE value.
(DISP_UP): Likewise.
(DISP_RIGHT): Likewise.
(DISP_DOWN): Likewise.
(DISP_HLINE): Likewise.
(DISP_VLINE): Likewise.
(DISP_UL): Likewise.
(DISP_UR): Likewise.
(DISP_LL): Likewise.
(DISP_LR): Likewise.
* term/i386/pc/console.c (pupa_console_putchar): New function.
* include/pupa/normal.h: New file.
* include/pupa/setjmp.h: Likewise.
* include/pupa/i386/setjmp.h: Likewise.
* normal/cmdline.c: Likewise.
* normal/command.c: Likewise.
* normal/main.c: Likewise.
* normal/menu.c: Likewise.
* normal/i386/setjmp.S: Likewise.
* loader/i386/pc/linux.c (pupa_rescue_cmd_linux): Made global.
(pupa_rescue_cmd_initrd): Likewise.
* loader/i386/pc/chainloader.c (pupa_rescue_cmd_chainloader):
Likewise.
* kern/i386/pc/startup.S (translation_table): New variable.
(translate_keycode): New function.
(pupa_console_getkey): Call translate_keycode.
* kern/rescue.c (attempt_normal_mode): New function.
(pupa_enter_rescue_mode): Attempt to execute the normal mode. If
it failed, print a message.
* kern/mm.c (pupa_real_malloc): Print more information when a
free magic is broken.
(pupa_free): If the first free header is not free actually, set
it to P.
* kern/main.c (pupa_load_normal_mode): Just load the module
"normal".
(pupa_main): Don't print the message
"Entering into rescue mode..." here.
* include/pupa/i386/pc/loader.h (pupa_rescue_cmd_initrd):
Declared.
(pupa_rescue_cmd_initrd): Likewise.
(pupa_rescue_cmd_initrd): Likewise.
* include/pupa/symbol.h (FUNCTION): Specify the type.
(VARIABLE): Likewise.
* include/pupa/err.h (pupa_err_t): Added
PUPA_ERR_UNKNOWN_COMMAND.
* include/pupa/dl.h (pupa_dl_set_prefix): Exported.
(pupa_dl_get_prefix): Likewise.
* conf/i386-pc.rmk (pkgdata_MODULES): Added normal.mod.
Added _chain.mod and _linux.mod instead of chain.mod and
linux.mod.
(chain_mod_SOURCES): Renamed to ...
(_chain_mod_SOURCES): ... this.
(chain_mod_CFLAGS): Renamed to ...
(_chain_mod_CFLAGS): ... this.
(linux_mod_SOURCES): Renamed to ...
(_linux_mod_SOURCES): ... this.
(linux_mod_CFLAGS): Renamed to ...
(_linux_mod_CFLAGS): ... this.
(normal_mod_SOURCES): New variable.
(normal_mod_CFLAGS): Likewise.
(normal_mod_ASFLAGS): Likewise.
2003-01-18 Yoshinori K. Okuji <okuji@enbug.org>
* kern/rescue.c (pupa_rescue_cmd_rmmod): Call pupa_dl_unload, if
possible.
* kern/dl.c (pupa_dl_ref): Refer dependending modules
recursively.
(pupa_dl_unref): Unrefer depending modules recursively.
Don't call pupa_dl_unload implicitly, because PUPA can crash if
a module is unloaded before one depending on that module is
unloaded.
(pupa_dl_unload): Unload depending modules explicitly,
if possible.