2004-01-11 Yoshinori K. Okuji <okuji@enbug.org>

* stage2/terminfo.c (ti_set_term): Use a pointer to struct
	terminfo instead to avoid GCC's bug, which inserts a reference
	to memcpy implicitly.
	(ti_get_term): Likewise.
	All callers are fixed.

	* stage2/terminfo.h (ti_set_term): Updated.
	(ti_get_term): Likewise.

	* stage2/shared.h (struct linux_kernel_header): New member,
	initrd_max_address. Defined in the boot protocol 2.03 or higher.

	* stage2/boot.c (load_initrd): If the boot protocol is greater
	than or equal to 2.03, use the field ``initrd_max_address''
	instead of LINUX_INITRD_MAX_ADDRESS.
This commit is contained in:
okuji 2004-01-11 09:38:04 +00:00
parent 36ccd040ac
commit 2269fa15f8
6 changed files with 39 additions and 18 deletions

View file

@ -1,3 +1,21 @@
2004-01-11 Yoshinori K. Okuji <okuji@enbug.org>
* stage2/terminfo.c (ti_set_term): Use a pointer to struct
terminfo instead to avoid GCC's bug, which inserts a reference
to memcpy implicitly.
(ti_get_term): Likewise.
All callers are fixed.
* stage2/terminfo.h (ti_set_term): Updated.
(ti_get_term): Likewise.
* stage2/shared.h (struct linux_kernel_header): New member,
initrd_max_address. Defined in the boot protocol 2.03 or higher.
* stage2/boot.c (load_initrd): If the boot protocol is greater
than or equal to 2.03, use the field ``initrd_max_address''
instead of LINUX_INITRD_MAX_ADDRESS.
2003-12-30 Yoshinori K. Okuji <okuji@enbug.org>
* stage2/fsys_ext2fs.c (ext2_is_fast_symlink): New function.

View file

@ -1,7 +1,7 @@
/* boot.c - load and bootstrap a kernel */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc.
* Copyright (C) 1999,2000,2001,2002,2003,2004 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
@ -786,6 +786,7 @@ load_initrd (char *initrd)
{
int len;
unsigned long moveto;
unsigned long max_addr;
struct linux_kernel_header *lh
= (struct linux_kernel_header *) (cur_addr - LINUX_SETUP_MOVE_SIZE);
@ -809,8 +810,10 @@ load_initrd (char *initrd)
moveto = (mbi.mem_upper + 0x400) << 10;
moveto = (moveto - len) & 0xfffff000;
if (moveto + len >= LINUX_INITRD_MAX_ADDRESS)
moveto = (LINUX_INITRD_MAX_ADDRESS - len) & 0xfffff000;
max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203
? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS);
if (moveto + len >= max_addr)
moveto = (max_addr - len) & 0xfffff000;
/* XXX: Linux 2.3.xx has a bug in the memory range check, so avoid
the last page.

View file

@ -1,7 +1,7 @@
/* builtins.c - the GRUB builtin commands */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc.
* Copyright (C) 1999,2000,2001,2002,2003,2004 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
@ -4208,12 +4208,12 @@ terminfo_func (char *arg, int flags)
return errnum;
}
ti_set_term (term);
ti_set_term (&term);
}
else
{
/* No option specifies printing out current settings. */
term = ti_get_term ();
ti_get_term (&term);
grub_printf ("name=%s\n",
ti_escape_string (term.name));

View file

@ -1,7 +1,7 @@
/* shared.h - definitions used in all GRUB-specific code */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc.
* Copyright (C) 1999,2000,2001,2002,2003,2004 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
@ -403,6 +403,7 @@ struct linux_kernel_header
unsigned short heap_end_ptr; /* Free memory after setup end */
unsigned short pad1; /* Unused */
char *cmd_line_ptr; /* Points to the kernel command line */
unsigned long initrd_addr_max; /* The highest address of initrd */
} __attribute__ ((packed));
/* Memory map address range descriptor used by GET_MMAP_ENTRY. */

View file

@ -1,7 +1,7 @@
/* terminfo.c - read a terminfo entry from the command line */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
* Copyright (C) 2002,2004 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
@ -245,15 +245,14 @@ ti_exit_standout_mode (void)
/* set the current terminal emulation to use */
void
ti_set_term (struct terminfo new)
ti_set_term (const struct terminfo *new)
{
term = new;
grub_memmove (&term, new, sizeof (struct terminfo));
}
/* return the current terminal emulation */
struct terminfo
ti_get_term(void)
/* get the current terminal emulation */
void
ti_get_term(struct terminfo *copy)
{
return term;
grub_memmove (copy, &term, sizeof (struct terminfo));
}

View file

@ -1,7 +1,7 @@
/* terminfo.h - read a terminfo entry from the command line */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2004 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
@ -40,8 +40,8 @@ char *ti_escape_string (const char *in);
char *ti_unescape_memory (const char *in, const char *end);
char *ti_unescape_string (const char *in);
void ti_set_term (struct terminfo term);
struct terminfo ti_get_term (void);
void ti_set_term (const struct terminfo *new);
void ti_get_term (struct terminfo *copy);
void ti_cursor_address (int x, int y);
void ti_clear_screen (void);