Make the syslinux_dump_*() functions pure debugging functions; that is
the way that they are used anyway, and this way they log to the same
place as dprintf.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
addr_t * start, addr_t * len, addr_t align);
/* Debugging functions */
addr_t * start, addr_t * len, addr_t align);
/* Debugging functions */
-void syslinux_dump_movelist(FILE * file, struct syslinux_movelist *ml);
-void syslinux_dump_memmap(FILE * file, struct syslinux_memmap *memmap);
+#ifdef DEBUG
+void syslinux_dump_movelist(struct syslinux_movelist *ml);
+void syslinux_dump_memmap(struct syslinux_memmap *memmap);
+#else
+#define syslinux_dump_movelist(x) ((void)0)
+#define syslinux_dump_memmap(x) ((void)0)
+#endif
#endif /* _SYSLINUX_MOVEBITS_H */
#endif /* _SYSLINUX_MOVEBITS_H */
- * Writes a syslinux_memmap out to a specified file. This is
- * intended for debugging.
+ * Writes a syslinux_memmap out to a dprintf.
#include <syslinux/movebits.h>
#include <syslinux/movebits.h>
-void syslinux_dump_memmap(FILE * file, struct syslinux_memmap *memmap)
+#ifdef DEBUG
+void syslinux_dump_memmap(struct syslinux_memmap *memmap)
- fprintf(file, "%10s %10s %10s\n"
+ dprintf("%10s %10s %10s\n"
"--------------------------------\n", "Start", "Length", "Type");
while (memmap->next) {
"--------------------------------\n", "Start", "Length", "Type");
while (memmap->next) {
- fprintf(file, "0x%08x 0x%08x %10d\n", memmap->start,
+ dprintf("0x%08x 0x%08x %10d\n", memmap->start,
memmap->next->start - memmap->start, memmap->type);
memmap = memmap->next;
}
}
memmap->next->start - memmap->start, memmap->type);
memmap = memmap->next;
}
}
#include <syslinux/movebits.h>
#include <syslinux/movebits.h>
-void syslinux_dump_movelist(FILE * file, struct syslinux_movelist *ml)
+#ifdef DEBUG
+void syslinux_dump_movelist(struct syslinux_movelist *ml)
- fprintf(file, "%10s %10s %10s\n"
+ dprintf("%10s %10s %10s\n"
"--------------------------------\n", "Dest", "Src", "Length");
while (ml) {
"--------------------------------\n", "Dest", "Src", "Length");
while (ml) {
- fprintf(file, "0x%08x 0x%08x 0x%08x\n", ml->dst, ml->src, ml->len);
+ dprintf("0x%08x 0x%08x 0x%08x\n", ml->dst, ml->src, ml->len);
if (!mmap || !amap)
goto bail;
if (!mmap || !amap)
goto bail;
dprintf("Initial memory map:\n");
dprintf("Initial memory map:\n");
- syslinux_dump_memmap(stdout, mmap);
-#endif
+ syslinux_dump_memmap(mmap);
/* 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
/* 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
/* Linux is OK with sp = 0 = 64K, but perhaps other things aren't... */
regs.esp.w[0] = min(cmdline_offset, (size_t) 0xfff0);
/* Linux is OK with sp = 0 = 64K, but perhaps other things aren't... */
regs.esp.w[0] = min(cmdline_offset, (size_t) 0xfff0);
dprintf("Final memory map:\n");
dprintf("Final memory map:\n");
- syslinux_dump_memmap(stdout, mmap);
+ syslinux_dump_memmap(mmap);
dprintf("Final available map:\n");
dprintf("Final available map:\n");
- syslinux_dump_memmap(stdout, amap);
+ syslinux_dump_memmap(amap);
dprintf("Initial movelist:\n");
dprintf("Initial movelist:\n");
- syslinux_dump_movelist(stdout, fraglist);
-#endif
+ syslinux_dump_movelist(fraglist);
syslinux_shuffle_boot_rm(fraglist, mmap, 0, ®s);
syslinux_shuffle_boot_rm(fraglist, mmap, 0, ®s);
addr_t ps, pe, xs, xe, delta;
bool advance;
addr_t ps, pe, xs, xe, delta;
bool advance;
dprintf("Before alias resolution:\n");
dprintf("Before alias resolution:\n");
- syslinux_dump_movelist(stdout, *fraglist);
-#endif
+ syslinux_dump_movelist(*fraglist);
dprintf("After alias resolution:\n");
dprintf("After alias resolution:\n");
- syslinux_dump_movelist(stdout, *fraglist);
+ syslinux_dump_movelist(*fraglist);
dprintf("Post-shuffle copies:\n");
dprintf("Post-shuffle copies:\n");
- syslinux_dump_movelist(stdout, *postcopy);
-#endif
+ syslinux_dump_movelist(*postcopy);
/* As long as there are unprocessed fragments in the chain... */
while ((fp = &frags, f = *fp)) {
/* As long as there are unprocessed fragments in the chain... */
while ((fp = &frags, f = *fp)) {
dprintf("Current free list:\n");
dprintf("Current free list:\n");
- syslinux_dump_memmap(stdout, mmap);
+ syslinux_dump_memmap(mmap);
dprintf("Current frag list:\n");
dprintf("Current frag list:\n");
- syslinux_dump_movelist(stdout, frags);
-#endif
+ syslinux_dump_movelist(frags);
/* Scan for fragments which can be discarded without action. */
if (f->src == f->dst) {
/* Scan for fragments which can be discarded without action. */
if (f->src == f->dst) {
- printf("Input move list:\n");
- syslinux_dump_movelist(stdout, frags);
- printf("Input free list:\n");
- syslinux_dump_memmap(stdout, memmap);
+ dprintf("Input move list:\n");
+ syslinux_dump_movelist(frags);
+ dprintf("Input free list:\n");
+ syslinux_dump_memmap(memmap);
if (syslinux_compute_movelist(&moves, frags, memmap)) {
printf("Failed to compute a move sequence\n");
return 1;
} else {
if (syslinux_compute_movelist(&moves, frags, memmap)) {
printf("Failed to compute a move sequence\n");
return 1;
} else {
- printf("Final move list:\n");
+ dprintf("Final move list:\n");
syslinux_dump_movelist(stdout, moves);
return 0;
}
syslinux_dump_movelist(stdout, moves);
return 0;
}
struct syslinux_memmap *range;
enum syslinux_memmap_types oldtype;
struct syslinux_memmap *range;
enum syslinux_memmap_types oldtype;
dprintf("Input memmap:\n");
dprintf("Input memmap:\n");
- syslinux_dump_memmap(stdout, *list);
-#endif
+ syslinux_dump_memmap(*list);
/* Remove this to make len == 0 mean all of memory */
if (len == 0)
/* Remove this to make len == 0 mean all of memory */
if (len == 0)
dprintf("After adding (%#x,%#x,%d):\n", start, len, type);
dprintf("After adding (%#x,%#x,%d):\n", start, len, type);
- syslinux_dump_memmap(stdout, *list);
-#endif
+ syslinux_dump_memmap(*list);
error("Failed to allocate initial memory map!\n");
return -1;
}
error("Failed to allocate initial memory map!\n");
return -1;
}
dprintf("Initial memory map:\n");
dprintf("Initial memory map:\n");
- syslinux_dump_memmap(stdout, mmap);
-#endif
+ syslinux_dump_memmap(mmap);
if (!mmap || !amap)
goto bail;
if (!mmap || !amap)
goto bail;
dprintf("Initial memory map:\n");
dprintf("Initial memory map:\n");
- syslinux_dump_memmap(stdout, mmap);
-#endif
+ syslinux_dump_memmap(mmap);
ph = (Elf32_Phdr *) (cptr + eh->e_phoff);
ph = (Elf32_Phdr *) (cptr + eh->e_phoff);
if (!stack_frame)
goto bail;
if (!stack_frame)
goto bail;
dprintf("Right before syslinux_memmap_largest()...\n");
dprintf("Right before syslinux_memmap_largest()...\n");
- syslinux_dump_memmap(stdout, amap);
-#endif
+ syslinux_dump_memmap(amap);
if (syslinux_memmap_largest(amap, SMT_FREE, &lstart, &llen))
goto bail; /* NO free memory?! */
if (syslinux_memmap_largest(amap, SMT_FREE, &lstart, &llen))
goto bail; /* NO free memory?! */
regs.eip = eh->e_entry;
regs.esp = stack_pointer;
regs.eip = eh->e_entry;
regs.esp = stack_pointer;
dprintf("Final memory map:\n");
dprintf("Final memory map:\n");
- syslinux_dump_memmap(stdout, mmap);
+ syslinux_dump_memmap(mmap);
dprintf("Final available map:\n");
dprintf("Final available map:\n");
- syslinux_dump_memmap(stdout, amap);
+ syslinux_dump_memmap(amap);
- syslinux_dump_movelist(stdout, ml);
-#endif
+ syslinux_dump_movelist(ml);
/* This should not return... */
fputs("Booting...\n", stdout);
/* This should not return... */
fputs("Booting...\n", stdout);
if (!mmap || !amap)
goto bail;
if (!mmap || !amap)
goto bail;
dprintf("Initial memory map:\n");
dprintf("Initial memory map:\n");
- syslinux_dump_memmap(stdout, mmap);
-#endif
+ syslinux_dump_memmap(mmap);
dprintf("Segment at 0x%08x len 0x%08x\n", where, len);
dprintf("Segment at 0x%08x len 0x%08x\n", where, len);
if (!stack_frame)
goto bail;
if (!stack_frame)
goto bail;
dprintf("Right before syslinux_memmap_largest()...\n");
dprintf("Right before syslinux_memmap_largest()...\n");
- syslinux_dump_memmap(stdout, amap);
-#endif
+ syslinux_dump_memmap(amap);
if (syslinux_memmap_largest(amap, SMT_FREE, &lstart, &llen))
goto bail; /* NO free memory?! */
if (syslinux_memmap_largest(amap, SMT_FREE, &lstart, &llen))
goto bail; /* NO free memory?! */
regs.eip = where;
regs.esp = stack_pointer;
regs.eip = where;
regs.esp = stack_pointer;
dprintf("Final memory map:\n");
dprintf("Final memory map:\n");
- syslinux_dump_memmap(stdout, mmap);
+ syslinux_dump_memmap(mmap);
dprintf("Final available map:\n");
dprintf("Final available map:\n");
- syslinux_dump_memmap(stdout, amap);
+ syslinux_dump_memmap(amap);
- syslinux_dump_movelist(stdout, ml);
-#endif
+ syslinux_dump_movelist(ml);
/* This should not return... */
fputs("Booting...\n", stdout);
/* This should not return... */
fputs("Booting...\n", stdout);