+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.
/* 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
{
int len;
unsigned long moveto;
+ unsigned long max_addr;
struct linux_kernel_header *lh
= (struct linux_kernel_header *) (cur_addr - LINUX_SETUP_MOVE_SIZE);
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.
/* 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
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));
/* 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
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. */
/* 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
/* 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));
}
-
/* 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
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);