1 |
/* boot.c - load and bootstrap a kernel */ |
/* boot.c - load and bootstrap a kernel */ |
2 |
/* |
/* |
3 |
* GRUB -- GRand Unified Bootloader |
* GRUB -- GRand Unified Bootloader |
4 |
* Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc. |
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. |
5 |
* |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
7 |
* 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 |
{ |
{ |
787 |
int len; |
int len; |
788 |
unsigned long moveto; |
unsigned long moveto; |
789 |
|
unsigned long max_addr; |
790 |
struct linux_kernel_header *lh |
struct linux_kernel_header *lh |
791 |
= (struct linux_kernel_header *) (cur_addr - LINUX_SETUP_MOVE_SIZE); |
= (struct linux_kernel_header *) (cur_addr - LINUX_SETUP_MOVE_SIZE); |
792 |
|
|
810 |
moveto = (mbi.mem_upper + 0x400) << 10; |
moveto = (mbi.mem_upper + 0x400) << 10; |
811 |
|
|
812 |
moveto = (moveto - len) & 0xfffff000; |
moveto = (moveto - len) & 0xfffff000; |
813 |
if (moveto + len >= LINUX_INITRD_MAX_ADDRESS) |
max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203 |
814 |
moveto = (LINUX_INITRD_MAX_ADDRESS - len) & 0xfffff000; |
? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS); |
815 |
|
if (moveto + len >= max_addr) |
816 |
|
moveto = (max_addr - len) & 0xfffff000; |
817 |
|
|
818 |
/* 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 |
819 |
the last page. |
the last page. |