recoginize >4gb memory.

This commit is contained in:
okuji 2000-06-18 13:58:48 +00:00
parent ada4cc670d
commit c67be0dccd
4 changed files with 54 additions and 27 deletions

View file

@ -1,3 +1,23 @@
2000-06-09 OKUJI Yoshinori <okuji@gnu.org>
* stage2/mb_info.h (AddrRangeDesc): Use one 64bits field instead
of two 32bits fields for BaseAddr and Length, respectively.
BaseAddrLow + BaseAddrHigh -> BaseAddr, LengthLow + LengthHigh
-> Length.
* stage2/builtins.c (displaymem_func): Print BaseAddr >> 32,
BaseAddr & 0xFFFFFFFF, Length >> 32 and Length & 0xFFFFFFFF,
instead of BaseAddrLow, BaseAddrHigh, LengthLow and LengthHigh,
for MAP.
* stage2/common.c (fakemap): Adjusted to the new definition of
AddrRangeDesc.
(mmap_avail_at): Change the type of TOP to unsigned long long.
If TOP is greater than 0xFFFFFFFF, set it to 0xFFFFFFFF, since
GRUB itself cannot deal with 64bits addresses at the moment.
(init_bios_info): When getting a maximum available address from
the memory map, use a new unsigned long long variable MAX_ADDR
as the temporary variable instead of MEMTMP. This should allow
GRUB to detect at most 4TB.
2000-06-18 OKUJI Yoshinori <okuji@gnu.org> 2000-06-18 OKUJI Yoshinori <okuji@gnu.org>
* docs/appendices.texi (FAQ): Added an question about Linux's * docs/appendices.texi (FAQ): Added an question about Linux's
@ -62,6 +82,7 @@
quite inconsistent with hard disks? Why not /dev/fd[a-z]?) quite inconsistent with hard disks? Why not /dev/fd[a-z]?)
Report by Pavel Roskin. Report by Pavel Roskin.
>>>>>>> 1.258
2000-06-08 OKUJI Yoshinori <okuji@gnu.org> 2000-06-08 OKUJI Yoshinori <okuji@gnu.org>
* docs/tutorial.texi (Network): The body is moved to ... * docs/tutorial.texi (Network): The body is moved to ...

View file

@ -810,8 +810,11 @@ displaymem_func (char *arg, int flags)
str = "Reserved"; str = "Reserved";
grub_printf (" %s: Base Address: 0x%x X 4GB + 0x%x,\n" grub_printf (" %s: Base Address: 0x%x X 4GB + 0x%x,\n"
" Length: %u X 4GB + %u bytes\n", " Length: %u X 4GB + %u bytes\n",
str, map->BaseAddrHigh, map->BaseAddrLow, str,
map->LengthHigh, map->LengthLow); (unsigned long) (map->BaseAddr >> 32),
(unsigned long) (map->BaseAddr & 0xFFFFFFFF),
(unsigned long) (map->Length >> 32),
(unsigned long) (map->Length & 0xFFFFFFFF));
map = ((struct AddrRangeDesc *) (((int) map) + 4 + map->size)); map = ((struct AddrRangeDesc *) (((int) map) + 4 + map->size));
} }

View file

@ -90,9 +90,9 @@ char *err_list[] =
/* static for BIOS memory map fakery */ /* static for BIOS memory map fakery */
static struct AddrRangeDesc fakemap[3] = static struct AddrRangeDesc fakemap[3] =
{ {
{20, 0, 0, 0, 0, MB_ARD_MEMORY}, {20, 0, 0, MB_ARD_MEMORY},
{20, 0x100000, 0, 0, 0, MB_ARD_MEMORY}, {20, 0x100000, 0, MB_ARD_MEMORY},
{20, 0x1000000, 0, 0, 0, MB_ARD_MEMORY} {20, 0x1000000, 0, MB_ARD_MEMORY}
}; };
/* A big problem is that the memory areas aren't guaranteed to be: /* A big problem is that the memory areas aren't guaranteed to be:
@ -101,7 +101,8 @@ static struct AddrRangeDesc fakemap[3] =
static unsigned long static unsigned long
mmap_avail_at (unsigned long bottom) mmap_avail_at (unsigned long bottom)
{ {
unsigned long top, addr; unsigned long long top;
unsigned long addr;
int cont; int cont;
top = bottom; top = bottom;
@ -113,19 +114,22 @@ mmap_avail_at (unsigned long bottom)
{ {
struct AddrRangeDesc *desc = (struct AddrRangeDesc *) addr; struct AddrRangeDesc *desc = (struct AddrRangeDesc *) addr;
if (desc->BaseAddrHigh == 0 if (desc->Type == MB_ARD_MEMORY
&& desc->Type == MB_ARD_MEMORY && desc->BaseAddr <= top
&& desc->BaseAddrLow <= top && desc->BaseAddr + desc->Length > top)
&& desc->BaseAddrLow + desc->LengthLow > top)
{ {
top = desc->BaseAddrLow + desc->LengthLow; top = desc->BaseAddr + desc->Length;
cont++; cont++;
} }
} }
} }
while (cont); while (cont);
/* For now, GRUB assumes 32bits addresses, so... */
if (top > 0xFFFFFFFF)
top = 0xFFFFFFFF;
return top - bottom; return (unsigned long) top - bottom;
} }
#endif /* ! STAGE1_5 */ #endif /* ! STAGE1_5 */
@ -203,6 +207,8 @@ init_bios_info (void)
if (mbi.mmap_length) if (mbi.mmap_length)
{ {
unsigned long long max_addr;
/* /*
* This is to get the lower memory, and upper memory (up to the * This is to get the lower memory, and upper memory (up to the
* first memory hole), into the "mbi.mem_{lower,upper}" * first memory hole), into the "mbi.mem_{lower,upper}"
@ -213,19 +219,18 @@ init_bios_info (void)
mbi.mem_upper = mmap_avail_at (0x100000) >> 10; mbi.mem_upper = mmap_avail_at (0x100000) >> 10;
/* Find the maximum available address. Ignore any memory holes. */ /* Find the maximum available address. Ignore any memory holes. */
for (memtmp = 0, addr = mbi.mmap_addr; for (max_addr = 0, addr = mbi.mmap_addr;
addr < mbi.mmap_addr + mbi.mmap_length; addr < mbi.mmap_addr + mbi.mmap_length;
addr += *((unsigned long *) addr) + 4) addr += *((unsigned long *) addr) + 4)
{ {
struct AddrRangeDesc *desc = (struct AddrRangeDesc *) addr; struct AddrRangeDesc *desc = (struct AddrRangeDesc *) addr;
if (desc->BaseAddrHigh == 0 if (desc->Type == MB_ARD_MEMORY
&& desc->Type == MB_ARD_MEMORY && desc->BaseAddr + desc->Length > max_addr)
&& desc->BaseAddrLow + desc->LengthLow > memtmp) max_addr = desc->BaseAddr + desc->Length;
memtmp = desc->BaseAddrLow + desc->LengthLow;
} }
extended_memory = (memtmp - 0x100000) >> 10; extended_memory = (max_addr - 0x100000) >> 10;
} }
else if ((memtmp = get_eisamemsize ()) != -1) else if ((memtmp = get_eisamemsize ()) != -1)
{ {
@ -245,9 +250,9 @@ init_bios_info (void)
mbi.mmap_addr = (unsigned long) fakemap; mbi.mmap_addr = (unsigned long) fakemap;
mbi.mmap_length = sizeof (fakemap); mbi.mmap_length = sizeof (fakemap);
fakemap[0].LengthLow = (mbi.mem_lower << 10); fakemap[0].Length = (mbi.mem_lower << 10);
fakemap[1].LengthLow = (memtmp << 10); fakemap[1].Length = (memtmp << 10);
fakemap[2].LengthLow = cont; fakemap[2].Length = cont;
} }
mbi.mem_upper = memtmp; mbi.mem_upper = memtmp;

View file

@ -1,7 +1,7 @@
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org> * Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
* Copyright (C) 2000 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
@ -46,10 +46,8 @@ struct mod_list
struct AddrRangeDesc struct AddrRangeDesc
{ {
unsigned long size; unsigned long size;
unsigned long BaseAddrLow; unsigned long long BaseAddr;
unsigned long BaseAddrHigh; unsigned long long Length;
unsigned long LengthLow;
unsigned long LengthHigh;
unsigned long Type; unsigned long Type;
/* unspecified optional padding... */ /* unspecified optional padding... */