@@ -14,6 +14,32 @@ static void announce_bootwrapper(void)
print_string("Boot-wrapper v0.2\r\n");
}
+#define announce_object(object, desc) \
+do { \
+ extern char object##__start[]; \
+ extern char object##__end[]; \
+ print_string("["); \
+ print_ulong_hex((unsigned long)object##__start); \
+ print_string(".."); \
+ print_ulong_hex((unsigned long)object##__end); \
+ print_string("] => " desc "\r\n"); \
+} while (0)
+
+static void announce_objects(void)
+{
+ print_string("Memory layout:\r\n");
+ announce_object(text, "boot-wrapper");
+ announce_object(mbox, "mbox");
+ announce_object(kernel, "kernel");
+#ifdef XEN
+ announce_object(xen, "xen");
+#endif
+ announce_object(dtb, "dtb");
+#ifdef USE_INITRD
+ announce_object(filesystem, "initrd");
+#endif
+}
+
void announce_arch(void);
void cpu_init_bootwrapper(void)
@@ -22,6 +48,7 @@ void cpu_init_bootwrapper(void)
init_uart();
announce_bootwrapper();
announce_arch();
+ announce_objects();
print_string("\r\n");
init_platform();
}
@@ -52,6 +52,20 @@ void print_string(const char *str)
print_char(*str++);
}
+#define HEX_CHARS_PER_LONG (2 * sizeof(long))
+#define NIBBLES_PER
+
+void print_ulong_hex(unsigned long val)
+{
+ const char hex_chars[16] = "0123456789abcdef";
+ int i;
+
+ for (i = HEX_CHARS_PER_LONG - 1; i >= 0; i--) {
+ int v = (val >> (4 * i)) & 0xf;
+ print_char(hex_chars[v]);
+ }
+}
+
void init_uart(void)
{
/*
@@ -11,6 +11,8 @@
void print_char(char c);
void print_string(const char *str);
+void print_ulong_hex(unsigned long val);
+
void init_uart(void);
void init_platform(void);
@@ -35,46 +35,54 @@ SECTIONS
* the boot section's *(.data)
*/
.kernel (PHYS_OFFSET + KERNEL_OFFSET): {
- kernel = .;
+ kernel__start = .;
KERNEL
+ kernel__end = .;
}
#ifdef XEN
.xen (PHYS_OFFSET + XEN_OFFSET): {
- xen = .;
+ xen__start = .;
XEN
+ xen__end = .;
}
- entrypoint = xen;
+ entrypoint = xen__start;
#else
- entrypoint = kernel;
+ entrypoint = kernel__start;
#endif
.dtb (PHYS_OFFSET + FDT_OFFSET): {
+ dtb__start = .;
dtb = .;
./fdt.dtb
+ dtb__end = .;
}
#ifdef USE_INITRD
.filesystem (PHYS_OFFSET + FS_OFFSET): {
- filesystem = .;
+ filesystem__start = .;
FILESYSTEM
- fs_size = . - filesystem;
+ filesystem__end = .;
}
#endif
.boot PHYS_OFFSET: {
+ text__start = .;
*(.init)
*(.text*)
*(.data* .rodata* .bss* COMMON)
*(.vectors)
*(.stack)
PROVIDE(etext = .);
+ text__end = .;
}
.mbox (PHYS_OFFSET + MBOX_OFFSET): {
+ mbox__start = .;
mbox = .;
QUAD(0x0)
+ mbox__end = .;
}
ASSERT(etext <= (PHYS_OFFSET + TEXT_LIMIT), ".text overflow!")
To make it easier to debug boot failures, log the location of memory objects at boot time. This is logged to the serial console as: | Boot-wrapper v0.2 | Entered at EL3 | Memory layout: | [0000000080000000..0000000080001f90] => boot-wrapper | [000000008000fff8..0000000080010000] => mbox | [0000000080200000..00000000822af200] => kernel | [0000000088000000..0000000088002857] => dtb Signed-off-by: Mark Rutland <mark.rutland@arm.com> --- common/init.c | 27 +++++++++++++++++++++++++++ common/platform.c | 14 ++++++++++++++ include/platform.h | 2 ++ model.lds.S | 20 ++++++++++++++------ 4 files changed, 57 insertions(+), 6 deletions(-)