2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
* loader/sparc64/ieee1275/linux.c (align_addr): Remove. (alloc_phys): Use ALIGN_UP instead of align_addr.
This commit is contained in:
parent
8c6052cea5
commit
2c0fcc3666
2 changed files with 9 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* loader/sparc64/ieee1275/linux.c (align_addr): Remove.
|
||||||
|
(alloc_phys): Use ALIGN_UP instead of align_addr.
|
||||||
|
|
||||||
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* loader/sparc64/ieee1275/linux.c (alloc_phys): Correct bounds checking.
|
* loader/sparc64/ieee1275/linux.c (alloc_phys): Correct bounds checking.
|
||||||
|
|
|
@ -173,12 +173,6 @@ grub_linux_unload (void)
|
||||||
|
|
||||||
#define FOUR_MB (4 * 1024 * 1024)
|
#define FOUR_MB (4 * 1024 * 1024)
|
||||||
|
|
||||||
static grub_addr_t
|
|
||||||
align_addr(grub_addr_t val, grub_addr_t align)
|
|
||||||
{
|
|
||||||
return (val + (align - 1)) & ~(align - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_addr_t
|
static grub_addr_t
|
||||||
alloc_phys (grub_addr_t size)
|
alloc_phys (grub_addr_t size)
|
||||||
{
|
{
|
||||||
|
@ -192,27 +186,27 @@ alloc_phys (grub_addr_t size)
|
||||||
if (type != 1)
|
if (type != 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
addr = align_addr (addr, FOUR_MB);
|
addr = ALIGN_UP (addr, FOUR_MB);
|
||||||
if (addr + size >= end)
|
if (addr + size >= end)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (addr >= grub_phys_start && addr < grub_phys_end)
|
if (addr >= grub_phys_start && addr < grub_phys_end)
|
||||||
{
|
{
|
||||||
addr = align_addr (grub_phys_end, FOUR_MB);
|
addr = ALIGN_UP (grub_phys_end, FOUR_MB);
|
||||||
if (addr + size >= end)
|
if (addr + size >= end)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((addr + size) >= grub_phys_start
|
if ((addr + size) >= grub_phys_start
|
||||||
&& (addr + size) < grub_phys_end)
|
&& (addr + size) < grub_phys_end)
|
||||||
{
|
{
|
||||||
addr = align_addr (grub_phys_end, FOUR_MB);
|
addr = ALIGN_UP (grub_phys_end, FOUR_MB);
|
||||||
if (addr + size >= end)
|
if (addr + size >= end)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loaded)
|
if (loaded)
|
||||||
{
|
{
|
||||||
grub_addr_t linux_end = align_addr (linux_paddr + linux_size, FOUR_MB);
|
grub_addr_t linux_end = ALIGN_UP (linux_paddr + linux_size, FOUR_MB);
|
||||||
|
|
||||||
if (addr >= linux_paddr && addr < linux_end)
|
if (addr >= linux_paddr && addr < linux_end)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue