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> 2003-12-30 Yoshinori K. Okuji <okuji@enbug.org>
* stage2/fsys_ext2fs.c (ext2_is_fast_symlink): New function. * stage2/fsys_ext2fs.c (ext2_is_fast_symlink): New function.

View file

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

View file

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

View file

@ -1,7 +1,7 @@
/* shared.h - definitions used in all GRUB-specific code */ /* shared.h - definitions used in all GRUB-specific code */
/* /*
* GRUB -- GRand Unified Bootloader * 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 * 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
@ -403,6 +403,7 @@ struct linux_kernel_header
unsigned short heap_end_ptr; /* Free memory after setup end */ unsigned short heap_end_ptr; /* Free memory after setup end */
unsigned short pad1; /* Unused */ unsigned short pad1; /* Unused */
char *cmd_line_ptr; /* Points to the kernel command line */ char *cmd_line_ptr; /* Points to the kernel command line */
unsigned long initrd_addr_max; /* The highest address of initrd */
} __attribute__ ((packed)); } __attribute__ ((packed));
/* Memory map address range descriptor used by GET_MMAP_ENTRY. */ /* 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 */ /* terminfo.c - read a terminfo entry from the command line */
/* /*
* GRUB -- GRand Unified Bootloader * 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 * 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
@ -245,15 +245,14 @@ ti_exit_standout_mode (void)
/* set the current terminal emulation to use */ /* set the current terminal emulation to use */
void 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 */ /* get the current terminal emulation */
struct terminfo void
ti_get_term(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 */ /* terminfo.h - read a terminfo entry from the command line */
/* /*
* GRUB -- GRand Unified Bootloader * 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 * 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,8 +40,8 @@ char *ti_escape_string (const char *in);
char *ti_unescape_memory (const char *in, const char *end); char *ti_unescape_memory (const char *in, const char *end);
char *ti_unescape_string (const char *in); char *ti_unescape_string (const char *in);
void ti_set_term (struct terminfo term); void ti_set_term (const struct terminfo *new);
struct terminfo ti_get_term (void); void ti_get_term (struct terminfo *copy);
void ti_cursor_address (int x, int y); void ti_cursor_address (int x, int y);
void ti_clear_screen (void); void ti_clear_screen (void);