aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-11-02 15:46:28 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-11-02 15:46:28 -0700
commit529722ee73a54cdb51b68c2b29076d9b1e8980d6 (patch)
tree8251181233c53728d3b3b90cb2d6faecb21c6e47
parent116c4b71bee6fa80d1d2c03f780a5ea64de3c886 (diff)
downloadsyslinux-elf-syslinux-3.53-pre2.tar.gz
syslinux-elf-syslinux-3.53-pre2.tar.xz
syslinux-elf-syslinux-3.53-pre2.zip
Optional debugging code for shuffle and boot and load_linuxsyslinux-3.53-pre2
Put (disabled) debugging code in shuffle.c and load_linux.c for future needs.
-rw-r--r--com32/lib/syslinux/load_linux.c26
-rw-r--r--com32/lib/syslinux/shuffle.c15
2 files changed, 41 insertions, 0 deletions
diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/syslinux/load_linux.c
index 13a0fa0d..74a52e66 100644
--- a/com32/lib/syslinux/load_linux.c
+++ b/com32/lib/syslinux/load_linux.c
@@ -38,6 +38,16 @@
#include <syslinux/bootrm.h>
#include <syslinux/movebits.h>
+#ifndef DEBUG
+# define DEBUG 0
+#endif
+#if DEBUG
+# include <stdio.h>
+# define dprintf printf
+#else
+# define dprintf(f, ...) ((void)0)
+#endif
+
struct linux_header {
uint8_t boot_sector_1[0x0020];
uint16_t old_cmd_line_magic;
@@ -225,6 +235,11 @@ int syslinux_boot_linux(void *kernel_buf, size_t kernel_size,
if (!mmap || !amap)
goto bail;
+#if DEBUG
+ dprintf("Initial memory map:\n");
+ syslinux_dump_memmap(stdout, mmap);
+#endif
+
/* If the user has specified a memory limit, mark that as unavailable.
Question: should we mark this off-limit in the mmap as well (meaning
it's unavailable to the boot loader, which probably has already touched
@@ -301,6 +316,17 @@ int syslinux_boot_linux(void *kernel_buf, size_t kernel_size,
/* regs.ip = 0; */
regs.esp.w[0] = cmdline_offset;
+#if DEBUG
+ dprintf("Final memory map:\n");
+ syslinux_dump_memmap(stdout, mmap);
+
+ dprintf("Final available map:\n");
+ syslinux_dump_memmap(stdout, amap);
+
+ dprintf("Initial movelist:\n");
+ syslinux_dump_movelist(stdout, fraglist);
+#endif
+
syslinux_shuffle_boot_rm(fraglist, mmap, 0, &regs);
bail:
diff --git a/com32/lib/syslinux/shuffle.c b/com32/lib/syslinux/shuffle.c
index 47ef51cb..774346ae 100644
--- a/com32/lib/syslinux/shuffle.c
+++ b/com32/lib/syslinux/shuffle.c
@@ -38,6 +38,16 @@
#include <com32.h>
#include <syslinux/movebits.h>
+#ifndef DEBUG
+# define DEBUG 0
+#endif
+#if DEBUG
+# include <stdio.h>
+# define dprintf printf
+#else
+# define dprintf(f, ...) ((void)0)
+#endif
+
struct shuffle_descriptor {
uint32_t dst, src, len;
};
@@ -53,6 +63,11 @@ int syslinux_prepare_shuffle(struct syslinux_movelist *fraglist,
if (syslinux_compute_movelist(&moves, fraglist, memmap))
goto bail;
+#if DEBUG
+ dprintf("Final movelist:\n");
+ syslinux_dump_movelist(stdout, moves);
+#endif
+
dp = __com32.cs_bounce;
np = 0;