From 3e74249c4c98463dac5541c232e8864bbc6ee11a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 27 Dec 2009 22:21:48 +0100 Subject: [PATCH 1/6] 2009-12-27 Vladimir Serbinenko * video/readers/jpeg.c (GRUB_MOD_FINI (grub_cmd_jpegtest)): Rename to .. (GRUB_MOD_FINI (video_reader_jpeg)): ...this --- ChangeLog | 5 +++++ video/readers/jpeg.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ebeb7ca93..68be8cfe6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-27 Vladimir Serbinenko + + * video/readers/jpeg.c (GRUB_MOD_FINI (grub_cmd_jpegtest)): Rename to .. + (GRUB_MOD_FINI (video_reader_jpeg)): ...this + 2009-12-27 Carles Pina i Estany * normal/cmdline.c (grub_cmdline_get): Print a space after prompt. diff --git a/video/readers/jpeg.c b/video/readers/jpeg.c index e7b69a208..3c3ac33bb 100644 --- a/video/readers/jpeg.c +++ b/video/readers/jpeg.c @@ -740,7 +740,7 @@ GRUB_MOD_INIT (video_reader_jpeg) #endif } -GRUB_MOD_FINI (grub_cmd_jpegtest) +GRUB_MOD_FINI (video_reader_jpeg) { #if defined(JPEG_DEBUG) grub_unregister_command (cmd); From 9c8739a456e7031a605f19ef0504687d853b894c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 27 Dec 2009 22:32:52 +0100 Subject: [PATCH 2/6] 2009-12-27 Vladimir Serbinenko * normal/menu_text.c (grub_print_message_indented): Prevent past-the-end-of-array dereference. --- ChangeLog | 5 +++++ normal/menu_text.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68be8cfe6..b6d1f02cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-27 Vladimir Serbinenko + + * normal/menu_text.c (grub_print_message_indented): Prevent + past-the-end-of-array dereference. + 2009-12-27 Vladimir Serbinenko * video/readers/jpeg.c (GRUB_MOD_FINI (grub_cmd_jpegtest)): Rename to .. diff --git a/normal/menu_text.c b/normal/menu_text.c index 4f2dfb78e..bac15f32b 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -137,8 +137,8 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right) next_new_line = (grub_uint32_t *) last_position; while (grub_getstringwidth (current_position, next_new_line) > line_len - || (*next_new_line != ' ' && next_new_line > current_position && - next_new_line != last_position)) + || (next_new_line != last_position && *next_new_line != ' ' + && next_new_line > current_position)) { next_new_line--; } From c181849b95d42134d9bcb08ade43525ed58024cc Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 28 Dec 2009 01:02:21 +0100 Subject: [PATCH 3/6] 2009-12-27 Vladimir Serbinenko * kern/parser.c (grub_parser_split_cmdline): Don't dereference NULL. --- ChangeLog | 4 ++++ kern/parser.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b6d1f02cc..70e24ef15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-12-27 Vladimir Serbinenko + + * kern/parser.c (grub_parser_split_cmdline): Don't dereference NULL. + 2009-12-27 Vladimir Serbinenko * normal/menu_text.c (grub_print_message_indented): Prevent diff --git a/kern/parser.c b/kern/parser.c index 006d67da7..dd4608ba9 100644 --- a/kern/parser.c +++ b/kern/parser.c @@ -145,13 +145,16 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline, *argc = 0; do { - if (! *rd) + if (! rd || !*rd) { if (getline) getline (&rd, 1); else break; } + if (!rd) + break; + for (; *rd; rd++) { grub_parser_state_t newstate; From 465b5a81300851f72ad9e5dc4b2fe261dac371b4 Mon Sep 17 00:00:00 2001 From: carles Date: Mon, 28 Dec 2009 19:11:59 +0100 Subject: [PATCH 4/6] 2009-12-28 Carles Pina i Estany * normal/misc.c (grub_normal_print_device_info): Add spaces and double quotes. --- ChangeLog | 5 +++++ normal/misc.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 70e24ef15..38ee89b04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-28 Carles Pina i Estany + + * normal/misc.c (grub_normal_print_device_info): Add spaces and double + quotes. + 2009-12-27 Vladimir Serbinenko * kern/parser.c (grub_parser_split_cmdline): Don't dereference NULL. diff --git a/normal/misc.c b/normal/misc.c index 18e20d2fc..17ba372ce 100644 --- a/normal/misc.c +++ b/normal/misc.c @@ -68,7 +68,10 @@ grub_normal_print_device_info (const char *name) if (grub_errno == GRUB_ERR_NONE) { if (label && grub_strlen (label)) - grub_printf_ (N_("- Label %s"), label); + { + grub_putchar (' '); + grub_printf_ (N_("- Label \"%s\""), label); + } grub_free (label); } grub_errno = GRUB_ERR_NONE; @@ -81,6 +84,7 @@ grub_normal_print_device_info (const char *name) if (grub_errno == GRUB_ERR_NONE) { grub_unixtime2datetime (tm, &datetime); + grub_putchar (' '); grub_printf_ (N_("- Last modification time %d-%02d-%02d " "%02d:%02d:%02d %s"), datetime.year, datetime.month, datetime.day, From 90d1e8797a459950943da91dbcd3712893e195f3 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Tue, 29 Dec 2009 14:04:18 +0000 Subject: [PATCH 5/6] 2009-12-29 Robert Millan * configure.ac: Check for TARGET_CFLAGS initialization before we initialize it ourselves (sigh). Move a few modifications to TARGET_CFLAGS to be unconditional (extra warning flags, loop alignment, i386 CPU extensions, GCC 4.4 eh_frame) * gettext/gettext.c (grub_gettext_delete_list): Add `void' argument. * term/i386/pc/at_keyboard.c (keyboard_controller_wait_untill_ready): Likewise. (keyboard_controller_led): Rename `led_status' paramter to avoid name conflict. --- ChangeLog | 14 +++++++ configure.ac | 82 +++++++++++++++++--------------------- gettext/gettext.c | 2 +- term/i386/pc/at_keyboard.c | 6 +-- 4 files changed, 54 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38ee89b04..588c035ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-12-29 Robert Millan + + * configure.ac: Check for TARGET_CFLAGS initialization before we + initialize it ourselves (sigh). + Move a few modifications to TARGET_CFLAGS to be unconditional + (extra warning flags, loop alignment, i386 CPU extensions, GCC 4.4 + eh_frame) + + * gettext/gettext.c (grub_gettext_delete_list): Add `void' argument. + * term/i386/pc/at_keyboard.c + (keyboard_controller_wait_untill_ready): Likewise. + (keyboard_controller_led): Rename `led_status' paramter to avoid + name conflict. + 2009-12-28 Carles Pina i Estany * normal/misc.c (grub_normal_print_device_info): Add spaces and double diff --git a/configure.ac b/configure.ac index 6560d3e31..3cac421e8 100644 --- a/configure.ac +++ b/configure.ac @@ -44,6 +44,11 @@ AC_CANONICAL_TARGET # Program name transformations AC_ARG_PROGRAM +# Optimization flag. Allow user to override. +if test "x$TARGET_CFLAGS" = x; then + TARGET_CFLAGS="$TARGET_CFLAGS -Os" +fi + case "$target_cpu" in i[[3456]]86) target_cpu=i386 ;; sparc) target_cpu=sparc64 ;; @@ -242,60 +247,45 @@ CPPFLAGS="$TARGET_CPPFLAGS" LDFLAGS="$TARGET_LDFLAGS" LIBS="" -if test "x$TARGET_CFLAGS" = x; then - # debug flags. - TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \ - -Wundef -Wstrict-prototypes -g" +# debug flags. +TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \ + -Wundef -Wstrict-prototypes -g" - # optimization flags. - AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [ - CFLAGS=-Os +# Force no alignment to save space on i386. +if test "x$target_cpu" = xi386; then + AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ + CFLAGS="$CFLAGS -falign-loops=1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_Os=yes], - [grub_cv_cc_Os=no]) + [grub_cv_cc_falign_loop=yes], + [grub_cv_cc_falign_loop=no]) ]) - if test "x$grub_cv_cc_Os" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -Os" + + if test "x$grub_cv_cc_falign_loop" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" else - TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops" + TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" fi - # Force no alignment to save space on i386. - if test "x$target_cpu" = xi386; then - AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ - CFLAGS="$CFLAGS -falign-loops=1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_falign_loop=yes], - [grub_cv_cc_falign_loop=no]) - ]) + # Some toolchains enable these features by default, but they need + # registers that aren't set up properly in GRUB. + TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" +fi - if test "x$grub_cv_cc_falign_loop" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" - else - TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" - fi +# By default, GCC 4.4 generates .eh_frame sections containing unwind +# information in some cases where it previously did not. GRUB doesn't need +# these and they just use up vital space. Restore the old compiler +# behaviour. +AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_fno_dwarf2_cfi_asm=yes], + [grub_cv_cc_fno_dwarf2_cfi_asm=no]) + CFLAGS="$SAVE_CFLAGS" +]) - # Some toolchains enable these features by default, but they need - # registers that aren't set up properly in GRUB. - TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow" - fi - - # By default, GCC 4.4 generates .eh_frame sections containing unwind - # information in some cases where it previously did not. GRUB doesn't need - # these and they just use up vital space. Restore the old compiler - # behaviour. - AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [ - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_fno_dwarf2_cfi_asm=yes], - [grub_cv_cc_fno_dwarf2_cfi_asm=no]) - CFLAGS="$SAVE_CFLAGS" - ]) - - if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" - fi +if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm" fi grub_apple_target_cc diff --git a/gettext/gettext.c b/gettext/gettext.c index 3472b2fb8..165feb332 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -298,7 +298,7 @@ grub_gettext_init_ext (const char *lang) } static void -grub_gettext_delete_list () +grub_gettext_delete_list (void) { struct grub_gettext_msg *item; diff --git a/term/i386/pc/at_keyboard.c b/term/i386/pc/at_keyboard.c index a53dbfa2d..4ad60c65c 100644 --- a/term/i386/pc/at_keyboard.c +++ b/term/i386/pc/at_keyboard.c @@ -72,7 +72,7 @@ static char keyboard_map_shift[128] = static grub_uint8_t grub_keyboard_controller_orig; static void -keyboard_controller_wait_untill_ready () +keyboard_controller_wait_untill_ready (void) { while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS))); } @@ -94,12 +94,12 @@ grub_keyboard_controller_read (void) } static void -keyboard_controller_led (grub_uint8_t led_status) +keyboard_controller_led (grub_uint8_t leds) { keyboard_controller_wait_untill_ready (); grub_outb (0xed, KEYBOARD_REG_DATA); keyboard_controller_wait_untill_ready (); - grub_outb (led_status & 0x7, KEYBOARD_REG_DATA); + grub_outb (leds & 0x7, KEYBOARD_REG_DATA); } /* FIXME: This should become an interrupt service routine. For now From f5a513064cf4e68cdd77cb885d5409c92d0a5403 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 29 Dec 2009 19:06:04 +0100 Subject: [PATCH 6/6] 2009-12-29 Vladimir Serbinenko * loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT (linux)): Fix syntax error. --- ChangeLog | 5 +++++ loader/sparc64/ieee1275/linux.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 588c035ad..c9a5d4eb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-29 Vladimir Serbinenko + + * loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT (linux)): + Fix syntax error. + 2009-12-29 Robert Millan * configure.ac: Check for TARGET_CFLAGS initialization before we diff --git a/loader/sparc64/ieee1275/linux.c b/loader/sparc64/ieee1275/linux.c index 3af93df7d..6ffad202e 100644 --- a/loader/sparc64/ieee1275/linux.c +++ b/loader/sparc64/ieee1275/linux.c @@ -518,7 +518,7 @@ GRUB_MOD_INIT(linux) cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, "Load Linux."); cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, - 0, "Load initrd".); + 0, "Load initrd."); my_mod = mod; }