Skip to content

Commit 91f3276

Browse files
committed
dmesg_mem_init_kernel_layout: emit PHYS/KERNEL_BSS on coupled arches
ARM32 and x86_32 print ".bss : 0x..." in the same mem_init() layout block. On coupled architectures virt_to_phys() is valid for kernel image addresses, so project the BSS virtual address to its physical counterpart and emit PHYS/KERNEL_BSS. This enables the BSS-resident gap refinement in kernel_image_phys_bound.c on those targets.
1 parent d4ddf21 commit 91f3276

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/components/dmesg_mem_init_kernel_layout.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,17 @@ static void emit_result(int idx, unsigned long addr) {
180180
kasld_result(KASLD_ADDR_PHYS, KASLD_SECTION_DRAM, phys, entries[idx].region,
181181
NULL);
182182
}
183+
/* On coupled architectures, the kernel image is linearly mapped, so
184+
* virt_to_phys() is valid for kernel BSS addresses too. Emitting a
185+
* PHYS/KERNEL_BSS result enables the BSS-resident gap refinement in
186+
* kernel_image_phys_bound.c on ARM32 and x86_32 (the only arches that
187+
* print a ".bss :" line; both are coupled). */
188+
if (strcmp(entries[idx].section, KASLD_SECTION_BSS) == 0) {
189+
unsigned long phys = virt_to_phys(addr);
190+
printf(" possible physical address: 0x%016lx\n", phys);
191+
kasld_result(KASLD_ADDR_PHYS, KASLD_SECTION_DRAM, phys,
192+
KASLD_REGION_KERNEL_BSS, NULL);
193+
}
183194
#endif
184195
}
185196

0 commit comments

Comments
 (0)