[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 17/19] [not for merge] print more debug info in mm
From: |
Daniel Axtens |
Subject: |
[PATCH 17/19] [not for merge] print more debug info in mm |
Date: |
Tue, 12 Oct 2021 18:30:06 +1100 |
This is handy for debugging - I'm including it in case anyone else hacking
on this area finds it helpful.
Signed-off-by: Daniel Axtens <dja@axtens.net>
---
grub-core/kern/mm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c
index 58d5b89e8860..811df1ab5ebb 100644
--- a/grub-core/kern/mm.c
+++ b/grub-core/kern/mm.c
@@ -135,6 +135,9 @@ grub_mm_init_region (void *addr, grub_size_t size)
for (p = &grub_mm_base, q = *p; q; p = &(q->next), q = *p)
{
/* Does this region come _before_ an existing region? */
+ grub_printf ("Extending w/ before %p + %" PRIxGRUB_SIZE " + %"
PRIxGRUB_SIZE " = %p ? %s\n",
+ (grub_uint8_t *)addr, size, q->pre_size, (grub_uint8_t *)q,
+ (grub_uint8_t *)addr + size + q->pre_size == (grub_uint8_t *)
q ? "yes" : "no");
if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q)
{
r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN);
@@ -143,6 +146,7 @@ grub_mm_init_region (void *addr, grub_size_t size)
if (r->pre_size >> GRUB_MM_ALIGN_LOG2)
{
+ grub_printf ("extending a region\n");
h = (grub_mm_header_t) (r + 1);
h->size = (r->pre_size >> GRUB_MM_ALIGN_LOG2);
h->magic = GRUB_MM_ALLOC_MAGIC;
@@ -156,9 +160,13 @@ grub_mm_init_region (void *addr, grub_size_t size)
}
/* Does this region come _after_ an existing region? */
+ grub_printf ("Extending w/ after %p + %" PRIxGRUB_SIZE " + %"
PRIxGRUB_SIZE " + %" PRIxGRUB_SIZE " = %p ? %s\n",
+ (grub_uint8_t *)q, sizeof(*q), q->size, q->post_size,
(grub_uint8_t *)addr,
+ (grub_uint8_t *)q + sizeof(*q) + q->size + q->post_size ==
(grub_uint8_t *) addr ? "yes" : "no");
if ((grub_uint8_t *)q + sizeof(*q) + q->size + q->post_size ==
(grub_uint8_t *) addr)
{
+ grub_printf ("extending a region\n");
h = (grub_mm_header_t) ((grub_uint8_t *)addr - q->post_size);
h->size = (size + q->post_size) >> GRUB_MM_ALIGN_LOG2;
h->magic = GRUB_MM_ALLOC_MAGIC;
--
2.30.2
- [PATCH 10/19] efi: mm: Always request a fixed number of pages on init, (continued)
- [PATCH 10/19] efi: mm: Always request a fixed number of pages on init, Daniel Axtens, 2021/10/12
- [PATCH 12/19] efi: mm: Pass up errors from `add_memory_regions ()`, Daniel Axtens, 2021/10/12
- [PATCH 09/19] mm: Allow dynamically requesting additional memory regions, Daniel Axtens, 2021/10/12
- [PATCH 11/19] efi: mm: Extract function to add memory regions, Daniel Axtens, 2021/10/12
- [PATCH 13/19] efi: mm: Implement runtime addition of pages, Daniel Axtens, 2021/10/12
- [PATCH 15/19] ieee1275: drop len -= 1 quirk in heap_init, Daniel Axtens, 2021/10/12
- [PATCH 14/19] ieee1275: request memory with ibm, client-architecture-support, Daniel Axtens, 2021/10/12
- [PATCH 17/19] [not for merge] print more debug info in mm,
Daniel Axtens <=
- [PATCH 16/19] ieee1275: support runtime memory claiming, Daniel Axtens, 2021/10/12
- [PATCH 18/19] [not for merge] ieee1275 debugging info, Daniel Axtens, 2021/10/12
- [PATCH 19/19] RFC: Ignore REGION_CONSECUTIVE, Daniel Axtens, 2021/10/12