2004-05-23 Yoshinori K. Okuji <okuji@enbug.org>

* stage2/char_io.c (grub_isspace): Use a switch sentense instead
	of an if sentense, because that reduces the size.

	* lib/device.c (read_device_map): Change the max number of DRIVE
	to 127 from 8. This was too strict.

	* stage2/asm.S (stop_floppy): Call pusha and popa outside the
	block of real mode code. Reported by Guillem Jover
	<guillem@debian.org>.
This commit is contained in:
okuji 2004-05-23 16:45:45 +00:00
parent 31def8459d
commit e43909c66d
7 changed files with 47 additions and 13 deletions

View file

@ -1,3 +1,15 @@
2004-05-23 Yoshinori K. Okuji <okuji@enbug.org>
* stage2/char_io.c (grub_isspace): Use a switch sentense instead
of an if sentense, because that reduces the size.
* lib/device.c (read_device_map): Change the max number of DRIVE
to 127 from 8. This was too strict.
* stage2/asm.S (stop_floppy): Call pusha and popa outside the
block of real mode code. Reported by Guillem Jover
<guillem@debian.org>.
2004-05-20 Damian Ivereigh <damian@cisco.com> 2004-05-20 Damian Ivereigh <damian@cisco.com>
* netboot/main.c: Fixed bootp only code so that options * netboot/main.c: Fixed bootp only code so that options

View file

@ -142,13 +142,14 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
target_alias = @target_alias@ target_alias = @target_alias@
sbin_PROGRAMS = grub sbin_PROGRAMS = grub
@SERIAL_SPEED_SIMULATION_FALSE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1
@SERIAL_SPEED_SIMULATION_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1 @SERIAL_SPEED_SIMULATION_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1
@SERIAL_SPEED_SIMULATION_FALSE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1
AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \ AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
-DFSYS_UFS2=1 \ -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
-DFSYS_FFS=1 -DFSYS_MINIX=1 -DSUPPORT_HERCULES=1 \ -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
-DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \
$(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \ $(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \
-I$(top_srcdir)/stage1 -I$(top_srcdir)/lib -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib

View file

@ -558,7 +558,7 @@ read_device_map (FILE *fp, char **map, const char *map_file)
show_error (line_number, "Bad device number"); show_error (line_number, "Bad device number");
return 0; return 0;
} }
else if (drive > 8) else if (drive > 127)
{ {
show_warning (line_number, show_warning (line_number,
"Ignoring %cd%d due to a BIOS limitation", "Ignoring %cd%d due to a BIOS limitation",
@ -821,9 +821,20 @@ restore_device_map (char **map)
} }
#ifdef __linux__ #ifdef __linux__
/* Linux-only function, because Linux has a bug that the disk cache for /* Linux-only functions, because Linux has a bug that the disk cache for
a whole disk is not consistent with the one for a partition of the a whole disk is not consistent with the one for a partition of the
disk. */ disk. */
int
is_disk_device (char **map, int drive)
{
struct stat st;
assert (map[drive] != 0);
assert (stat (map[drive], &st) == 0);
/* For now, disk devices under Linux are all block devices. */
return S_ISBLK (st.st_mode);
}
int int
write_to_partition (char **map, int drive, int partition, write_to_partition (char **map, int drive, int partition,
int sector, int size, const char *buf) int sector, int size, const char *buf)

View file

@ -1,7 +1,7 @@
/* device.h - Define macros and declare prototypes for device.c */ /* device.h - Define macros and declare prototypes for device.c */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 1999, 2000 Free Software Foundation, Inc. * Copyright (C) 1999,2000,2004 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -40,6 +40,7 @@ extern int init_device_map (char ***map, const char *map_file,
extern void restore_device_map (char **map); extern void restore_device_map (char **map);
#ifdef __linux__ #ifdef __linux__
extern int is_disk_device (char **map, int drive);
extern int write_to_partition (char **map, int drive, int partition, extern int write_to_partition (char **map, int drive, int partition,
int offset, int size, const char *buf); int offset, int size, const char *buf);
#endif /* __linux__ */ #endif /* __linux__ */

View file

@ -1,6 +1,6 @@
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -211,14 +211,14 @@ ENTRY(hard_stop)
* jumped to with a known state. * jumped to with a known state.
*/ */
ENTRY(stop_floppy) ENTRY(stop_floppy)
pusha
call EXT_C(prot_to_real) call EXT_C(prot_to_real)
.code16 .code16
pusha
xorb %dl, %dl xorb %dl, %dl
int $0x13 int $0x13
popa
DATA32 call EXT_C(real_to_prot) DATA32 call EXT_C(real_to_prot)
.code32 .code32
popa
ret ret
/* /*

View file

@ -912,8 +912,16 @@ grub_tolower (int c)
int int
grub_isspace (int c) grub_isspace (int c)
{ {
if (c == ' ' || c == '\t' || c == '\r' || c == '\n') switch (c)
{
case ' ':
case '\t':
case '\r':
case '\n':
return 1; return 1;
default:
break;
}
return 0; return 0;
} }

View file

@ -366,7 +366,8 @@ int
devwrite (int sector, int sector_count, char *buf) devwrite (int sector, int sector_count, char *buf)
{ {
#if defined(GRUB_UTIL) && defined(__linux__) #if defined(GRUB_UTIL) && defined(__linux__)
if (current_partition != 0xFFFFFF) if (current_partition != 0xFFFFFF
&& is_disk_device (device_map, current_drive))
{ {
/* If the grub shell is running under Linux and the user wants to /* If the grub shell is running under Linux and the user wants to
embed a Stage 1.5 into a partition instead of a MBR, use system embed a Stage 1.5 into a partition instead of a MBR, use system