* grub-core/lib/relocator.c (allocate_regstart)
[!DEBUG_RELOCATOR_NOMEM_DPRINTF]: Avoid grub_dprintf since not all terminals are capabple of malloc-free operation. (allocate_inreg) [!DEBUG_RELOCATOR_NOMEM_DPRINTF]: Likewise. (malloc_in_range) [!DEBUG_RELOCATOR_NOMEM_DPRINTF]: Likewise.
This commit is contained in:
parent
9f3677d3c1
commit
a1dc717c58
2 changed files with 18 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/lib/relocator.c (allocate_regstart)
|
||||||
|
[!DEBUG_RELOCATOR_NOMEM_DPRINTF]: Avoid grub_dprintf since not all
|
||||||
|
terminals are capabple of malloc-free operation.
|
||||||
|
(allocate_inreg) [!DEBUG_RELOCATOR_NOMEM_DPRINTF]: Likewise.
|
||||||
|
(malloc_in_range) [!DEBUG_RELOCATOR_NOMEM_DPRINTF]: Likewise.
|
||||||
|
|
||||||
2011-03-29 Mario Limonciello <Mario_Limonciello@Dell.com>
|
2011-03-29 Mario Limonciello <Mario_Limonciello@Dell.com>
|
||||||
|
|
||||||
* util/grub-setup.c: Copy the partition table zone if floppy support
|
* util/grub-setup.c: Copy the partition table zone if floppy support
|
||||||
|
|
|
@ -134,9 +134,10 @@ allocate_regstart (grub_phys_addr_t addr, grub_size_t size, grub_mm_region_t rb,
|
||||||
grub_addr_t newreg_size, newreg_presize;
|
grub_addr_t newreg_size, newreg_presize;
|
||||||
grub_mm_header_t new_header;
|
grub_mm_header_t new_header;
|
||||||
grub_mm_header_t hb = (grub_mm_header_t) (rb + 1);
|
grub_mm_header_t hb = (grub_mm_header_t) (rb + 1);
|
||||||
|
|
||||||
grub_dprintf ("relocator", "ra = %p, rb = %p\n", regancestor, rb);
|
|
||||||
|
|
||||||
|
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||||
|
grub_dprintf ("relocator", "ra = %p, rb = %p\n", regancestor, rb);
|
||||||
|
#endif
|
||||||
newreg_start = ALIGN_UP (newreg_raw_start, GRUB_MM_ALIGN);
|
newreg_start = ALIGN_UP (newreg_raw_start, GRUB_MM_ALIGN);
|
||||||
newreg_presize = newreg_start - newreg_raw_start;
|
newreg_presize = newreg_start - newreg_raw_start;
|
||||||
newreg_size = rb->size - (newreg_start - (grub_addr_t) rb);
|
newreg_size = rb->size - (newreg_start - (grub_addr_t) rb);
|
||||||
|
@ -179,11 +180,12 @@ allocate_regstart (grub_phys_addr_t addr, grub_size_t size, grub_mm_region_t rb,
|
||||||
if ((void *) h < (void *) (newreg + 1))
|
if ((void *) h < (void *) (newreg + 1))
|
||||||
grub_fatal ("Failed to adjust memory region: %p, %p, %p, %p, %p",
|
grub_fatal ("Failed to adjust memory region: %p, %p, %p, %p, %p",
|
||||||
newreg, newreg->first, h, hp, hb);
|
newreg, newreg->first, h, hp, hb);
|
||||||
|
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||||
if ((void *) h == (void *) (newreg + 1))
|
if ((void *) h == (void *) (newreg + 1))
|
||||||
grub_dprintf ("relocator",
|
grub_dprintf ("relocator",
|
||||||
"Free start memory region: %p, %p, %p, %p, %p",
|
"Free start memory region: %p, %p, %p, %p, %p",
|
||||||
newreg, newreg->first, h, hp, hb);
|
newreg, newreg->first, h, hp, hb);
|
||||||
|
#endif
|
||||||
hp = h;
|
hp = h;
|
||||||
h = h->next;
|
h = h->next;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +202,7 @@ allocate_inreg (grub_phys_addr_t paddr, grub_size_t size,
|
||||||
struct grub_mm_header *foll = NULL;
|
struct grub_mm_header *foll = NULL;
|
||||||
grub_addr_t vaddr = (grub_addr_t) hb + (paddr - grub_vtop (hb));
|
grub_addr_t vaddr = (grub_addr_t) hb + (paddr - grub_vtop (hb));
|
||||||
|
|
||||||
#ifdef DEBUG_RELOCATOR
|
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||||
grub_dprintf ("relocator", "inreg paddr = 0x%lx, size = %lu,"
|
grub_dprintf ("relocator", "inreg paddr = 0x%lx, size = %lu,"
|
||||||
" hb = %p, hbp = %p, rb = %p, vaddr = 0x%lx\n",
|
" hb = %p, hbp = %p, rb = %p, vaddr = 0x%lx\n",
|
||||||
(unsigned long) paddr, (unsigned long) size, hb, hbp,
|
(unsigned long) paddr, (unsigned long) size, hb, hbp,
|
||||||
|
@ -213,8 +215,10 @@ allocate_inreg (grub_phys_addr_t paddr, grub_size_t size,
|
||||||
foll = (void *) ALIGN_UP (vaddr + size, GRUB_MM_ALIGN);
|
foll = (void *) ALIGN_UP (vaddr + size, GRUB_MM_ALIGN);
|
||||||
foll->magic = GRUB_MM_FREE_MAGIC;
|
foll->magic = GRUB_MM_FREE_MAGIC;
|
||||||
foll->size = hb + hb->size - foll;
|
foll->size = hb + hb->size - foll;
|
||||||
|
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||||
grub_dprintf ("relocator", "foll = %p, foll->size = %lu\n", foll,
|
grub_dprintf ("relocator", "foll = %p, foll->size = %lu\n", foll,
|
||||||
(unsigned long) foll->size);
|
(unsigned long) foll->size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vaddr - (grub_addr_t) hb >= sizeof (*hb))
|
if (vaddr - (grub_addr_t) hb >= sizeof (*hb))
|
||||||
|
@ -821,9 +825,11 @@ malloc_in_range (struct grub_relocator *rel,
|
||||||
fend
|
fend
|
||||||
= ALIGN_UP (alloc_end,
|
= ALIGN_UP (alloc_end,
|
||||||
GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT);
|
GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT);
|
||||||
|
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||||
grub_dprintf ("relocator", "requesting %lx-%lx\n",
|
grub_dprintf ("relocator", "requesting %lx-%lx\n",
|
||||||
(unsigned long) fstart,
|
(unsigned long) fstart,
|
||||||
(unsigned long) fend);
|
(unsigned long) fend);
|
||||||
|
#endif
|
||||||
/* The failure here can be very expensive. */
|
/* The failure here can be very expensive. */
|
||||||
if (!grub_relocator_firmware_alloc_region (fstart,
|
if (!grub_relocator_firmware_alloc_region (fstart,
|
||||||
fend - fstart))
|
fend - fstart))
|
||||||
|
|
Loading…
Reference in a new issue