From da7278fc6d0a7f3a1b3cf4dfa16c11e607508911 Mon Sep 17 00:00:00 2001 From: okuji Date: Wed, 29 Jan 2003 09:13:56 +0000 Subject: [PATCH] 2003-01-29 Yoshinori K. Okuji From Ilguiz Latypov: * configure.in: Fix a syntax error in a sed script. * stage2/bios.c (get_diskinfo): PhoenixBIOS 4.0 Revision 6.0 for ZF Micro might understand the greater buffer size for the "get drive parameters" int 0x13 call in its own way. Supposedly the BIOS assumes even bigger space is available and thus corrupts the stack. This is why we specify the exactly necessary size of 0x42 bytes. --- ChangeLog | 11 +++++++++++ configure | 2 +- configure.in | 4 ++-- stage2/bios.c | 11 +++++++++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67193b051..960037605 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-01-29 Yoshinori K. Okuji + + From Ilguiz Latypov: + * configure.in: Fix a syntax error in a sed script. + * stage2/bios.c (get_diskinfo): PhoenixBIOS 4.0 Revision 6.0 + for ZF Micro might understand the greater buffer size for the + "get drive parameters" int 0x13 call in its own way. + Supposedly the BIOS assumes even bigger space is available and + thus corrupts the stack. This is why we specify the exactly + necessary size of 0x42 bytes. + 2003-01-25 Yoshinori K. Okuji From Steven Dick : diff --git a/configure b/configure index e1c0b1662..fcbfa1220 100644 --- a/configure +++ b/configure @@ -2918,7 +2918,7 @@ fi if test "x$ac_cv_c_compiler_gnu" = xyes; then if test "x$default_CFLAGS" = xyes; then # Autoconf may set CFLAGS to -O2 and/or -g. So eliminate them. - CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[0-9]/g'` -g" + CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[0-9]//g'` -g" # If the user specify the directory for binutils, add the option `-B'. if test "x$with_binutils" != x; then CFLAGS="-B$with_binutils/ $CFLAGS" diff --git a/configure.in b/configure.in index 767f0acc5..875fa1297 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Configure script for GRUB. -dnl Copyright 1999,2000,2001,2002 Free Software Foundation, Inc. +dnl Copyright 1999,2000,2001,2002,2003 Free Software Foundation, Inc. dnl Permission to use, copy, modify and distribute this software and its dnl documentation is hereby granted, provided that both the copyright @@ -78,7 +78,7 @@ fi if test "x$ac_cv_prog_gcc" = xyes; then if test "x$default_CFLAGS" = xyes; then # Autoconf may set CFLAGS to -O2 and/or -g. So eliminate them. - CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[[0-9]]/g'` -g" + CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[[0-9]]//g'` -g" # If the user specify the directory for binutils, add the option `-B'. if test "x$with_binutils" != x; then CFLAGS="-B$with_binutils/ $CFLAGS" diff --git a/stage2/bios.c b/stage2/bios.c index 6e61b38d5..558034d37 100644 --- a/stage2/bios.c +++ b/stage2/bios.c @@ -1,7 +1,7 @@ /* bios.c - implement C part of low-level BIOS disk input and output */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2003 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 @@ -169,7 +169,14 @@ get_diskinfo (int drive, struct geometry *geometry) /* It is safe to clear out DRP. */ grub_memset (&drp, 0, sizeof (drp)); - drp.size = sizeof (drp); + /* PhoenixBIOS 4.0 Revision 6.0 for ZF Micro might understand + the greater buffer size for the "get drive parameters" int + 0x13 call in its own way. Supposedly the BIOS assumes even + bigger space is available and thus corrupts the stack. + This is why we specify the exactly necessary size of 0x42 + bytes. */ + drp.size = sizeof (drp) - sizeof (drp.dummy); + err = get_diskinfo_int13_extensions (drive, &drp); if (! err) {