From b7bf2733d6604bdb6529d25cea880c5871128392 Mon Sep 17 00:00:00 2001 From: Erik van der Kouwe Date: Mon, 10 May 2010 18:07:59 +0000 Subject: [PATCH] Intermediate boot verbosity level EXTRA (2), MAX moved to 3 --- boot/bootimage.c | 55 ++++++++++++++++++++++--------------------- include/minix/const.h | 3 ++- kernel/debug.h | 1 + kernel/main.c | 18 +++++++------- kernel/start.c | 4 ++-- 5 files changed, 42 insertions(+), 39 deletions(-) diff --git a/boot/bootimage.c b/boot/bootimage.c index 2e3754cfe..3638199b1 100644 --- a/boot/bootimage.c +++ b/boot/bootimage.c @@ -30,10 +30,11 @@ static int block_size = 0; static int verboseboot = VERBOSEBOOT_QUIET; -#define DEBUGBASIC(params) do { \ - if (verboseboot >= VERBOSEBOOT_BASIC) printf params; } while (0) -#define DEBUGMAX(params) do { \ - if (verboseboot >= VERBOSEBOOT_MAX) printf params; } while (0) +#define DEBUG_PRINT(params, level) do { \ + if (verboseboot >= (level)) printf params; } while (0) +#define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC) +#define DEBUGEXTRA(params) DEBUG_PRINT(params, VERBOSEBOOT_EXTRA) +#define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX) extern int serial_line; extern u16_t vid_port; /* Video i/o port. */ @@ -379,7 +380,7 @@ int get_segment(u32_t *vsec, long *size, u32_t *addr, u32_t limit) } if (*addr + click_size > limit) { - DEBUGMAX(("get_segment: out of memory; " + DEBUGEXTRA(("get_segment: out of memory; " "addr=0x%lx; limit=0x%lx; size=%lx\n", *addr, limit, size)); errno= ENOMEM; @@ -494,7 +495,7 @@ void exec_image(char *image) procp= &process[i]; /* Read header. */ - DEBUGMAX(("Reading header... ")); + DEBUGEXTRA(("Reading header... ")); for (;;) { if ((buf= get_sector(vsec++)) == nil) return; @@ -508,7 +509,7 @@ void exec_image(char *image) /* Bad label, skip this process. */ vsec+= proc_size(&hdr); } - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); /* Sanity check: an 8086 can't run a 386 kernel. */ if (hdr.process.a_cpu == A_I80386 && processor < 386) { @@ -533,11 +534,11 @@ void exec_image(char *image) /* Save a copy of the header for the kernel, with a_syms * misused as the address where the process is loaded at. */ - DEBUGMAX(("raw_copy(0x%x, 0x%lx, 0x%x)... ", + DEBUGEXTRA(("raw_copy(0x%x, 0x%lx, 0x%x)... ", aout + i * A_MINHDR, mon2abs(&hdr.process), A_MINHDR)); hdr.process.a_syms= addr; raw_copy(aout + i * A_MINHDR, mon2abs(&hdr.process), A_MINHDR); - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); if (!banner) { DEBUGBASIC((" cs ds text data bss")); @@ -547,7 +548,7 @@ void exec_image(char *image) } /* Segment sizes. */ - DEBUGMAX(("a_text=0x%lx; a_data=0x%lx; a_bss=0x%lx; a_flags=0x%x)\n", + DEBUGEXTRA(("a_text=0x%lx; a_data=0x%lx; a_bss=0x%lx; a_flags=0x%x)\n", hdr.process.a_text, hdr.process.a_data, hdr.process.a_bss, hdr.process.a_flags)); @@ -574,10 +575,10 @@ void exec_image(char *image) /* Separate I&D: two segments. Common I&D: only one. */ if (hdr.process.a_flags & A_SEP) { /* Read the text segment. */ - DEBUGMAX(("get_segment(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n", + DEBUGEXTRA(("get_segment(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n", vsec, a_text, addr, limit)); if (!get_segment(&vsec, &a_text, &addr, limit)) return; - DEBUGMAX(("get_segment done vsec=0x%lx a_text=0x%lx " + DEBUGEXTRA(("get_segment done vsec=0x%lx a_text=0x%lx " "addr=0x%lx\n", vsec, a_text, addr)); @@ -593,10 +594,10 @@ void exec_image(char *image) } /* Read the data segment. */ - DEBUGMAX(("get_segment(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n", + DEBUGEXTRA(("get_segment(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n", vsec, a_data, addr, limit)); if (!get_segment(&vsec, &a_data, &addr, limit)) return; - DEBUGMAX(("get_segment done vsec=0x%lx a_data=0x%lx " + DEBUGEXTRA(("get_segment done vsec=0x%lx a_data=0x%lx " "addr=0x%lx\n", vsec, a_data, addr)); @@ -618,10 +619,10 @@ void exec_image(char *image) a_bss-= n; /* Zero out bss. */ - DEBUGMAX(("\nraw_clear(0x%lx, 0x%lx); limit=0x%lx... ", addr, n, limit)); + DEBUGEXTRA(("\nraw_clear(0x%lx, 0x%lx); limit=0x%lx... ", addr, n, limit)); if (addr + n > limit) { errno= ENOMEM; return; } raw_clear(addr, n); - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); addr+= n; /* And the number of stack clicks. */ @@ -671,9 +672,9 @@ void exec_image(char *image) } /* Patch sizes, etc. into kernel data. */ - DEBUGMAX(("patch_sizes()... ")); + DEBUGEXTRA(("patch_sizes()... ")); patch_sizes(); - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); #if !DOS if (!(k_flags & K_MEML)) { @@ -683,31 +684,31 @@ void exec_image(char *image) #endif /* Run the trailer function just before starting Minix. */ - DEBUGMAX(("run_trailer()... ")); + DEBUGEXTRA(("run_trailer()... ")); if (!run_trailer()) { errno= 0; return; } - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); /* Translate the boot parameters to what Minix likes best. */ - DEBUGMAX(("params2params(0x%x, 0x%x)... ", params, sizeof(params))); + DEBUGEXTRA(("params2params(0x%x, 0x%x)... ", params, sizeof(params))); if (!params2params(params, sizeof(params))) { errno= 0; return; } - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); /* Set the video to the required mode. */ if ((console= b_value("console")) == nil || (mode= a2x(console)) == 0) { mode= strcmp(b_value("chrome"), "color") == 0 ? COLOR_MODE : MONO_MODE; } - DEBUGMAX(("set_mode(%d)... ", mode)); + DEBUGEXTRA(("set_mode(%d)... ", mode)); set_mode(mode); - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); /* Close the disk. */ - DEBUGMAX(("dev_close()... ")); + DEBUGEXTRA(("dev_close()... ")); (void) dev_close(); - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); /* Minix. */ - DEBUGMAX(("minix(0x%lx, 0x%lx, 0x%lx, 0x%x, 0x%x, 0x%lx)\n", + DEBUGEXTRA(("minix(0x%lx, 0x%lx, 0x%lx, 0x%x, 0x%x, 0x%lx)\n", process[KERNEL_IDX].entry, process[KERNEL_IDX].cs, process[KERNEL_IDX].ds, params, sizeof(params), aout)); minix(process[KERNEL_IDX].entry, process[KERNEL_IDX].cs, diff --git a/include/minix/const.h b/include/minix/const.h index 14bd7ce9c..d7e8c2ea3 100644 --- a/include/minix/const.h +++ b/include/minix/const.h @@ -179,7 +179,8 @@ /* Values for the "verbose" boot monitor variable */ #define VERBOSEBOOT_QUIET 0 #define VERBOSEBOOT_BASIC 1 -#define VERBOSEBOOT_MAX 2 +#define VERBOSEBOOT_EXTRA 2 +#define VERBOSEBOOT_MAX 3 #define VERBOSEBOOTVARNAME "verbose" #endif /* _MINIX_CONST_H */ diff --git a/kernel/debug.h b/kernel/debug.h index 0c9e60fc5..78c4b9948 100644 --- a/kernel/debug.h +++ b/kernel/debug.h @@ -67,6 +67,7 @@ #define DEBUG_PRINT(params, level) do { \ if (verboseboot >= (level)) printf params; } while (0) #define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC) +#define DEBUGEXTRA(params) DEBUG_PRINT(params, VERBOSEBOOT_EXTRA) #define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX) #endif diff --git a/kernel/main.c b/kernel/main.c index ffee52cf4..e0ad78cdb 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -41,7 +41,7 @@ PUBLIC void main(void) /* Global value to test segment sanity. */ magictest = MAGICTEST; - DEBUGMAX(("main()\n")); + DEBUGEXTRA(("main()\n")); /* Clear the process table. Anounce each slot as empty and set up mappings * for proc_addr() and proc_nr() macros. Do the same for the table with @@ -76,7 +76,7 @@ PUBLIC void main(void) int ipc_to_m, kcalls; ip = &image[i]; /* process' attributes */ - DEBUGMAX(("initializing %s... ", ip->proc_name)); + DEBUGEXTRA(("initializing %s... ", ip->proc_name)); rp = proc_addr(ip->proc_nr); /* get process pointer */ ip->endpoint = rp->p_endpoint; /* ipc endpoint */ rp->p_scheduler = NULL; /* no user space scheduler */ @@ -206,18 +206,18 @@ PUBLIC void main(void) if (rp->p_nr < 0) RTS_SET(rp, RTS_PROC_STOP); RTS_UNSET(rp, RTS_SLOT_FREE); /* remove RTS_SLOT_FREE and schedule */ alloc_segments(rp); - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); } /* Architecture-dependent initialization. */ - DEBUGMAX(("arch_init()... ")); + DEBUGEXTRA(("arch_init()... ")); arch_init(); - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); /* System and processes initialization */ - DEBUGMAX(("system_init()... ")); + DEBUGEXTRA(("system_init()... ")); system_init(); - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); #if SPROFILE sprofiling = 0; /* we're not profiling until instructed to */ @@ -251,9 +251,9 @@ PUBLIC void main(void) FIXME("PROC check enabled"); #endif - DEBUGMAX(("cycles_accounting_init()... ")); + DEBUGEXTRA(("cycles_accounting_init()... ")); cycles_accounting_init(); - DEBUGMAX(("done\n")); + DEBUGEXTRA(("done\n")); assert(runqueues_ok()); diff --git a/kernel/start.c b/kernel/start.c index ea5bb353f..68abd3121 100644 --- a/kernel/start.c +++ b/kernel/start.c @@ -46,7 +46,7 @@ PUBLIC void cstart( if ((value = get_value(params_buffer, VERBOSEBOOTVARNAME))) verboseboot = atoi(value); - DEBUGMAX(("cstart\n")); + DEBUGEXTRA(("cstart\n")); /* Record miscellaneous information for user-space servers. */ kinfo.nr_procs = NR_PROCS; @@ -106,7 +106,7 @@ PUBLIC void cstart( * reload selectors and call main(). */ - DEBUGMAX(("intr_init(%d, 0)\n", INTS_MINIX)); + DEBUGEXTRA(("intr_init(%d, 0)\n", INTS_MINIX)); intr_init(INTS_MINIX, 0); } -- 2.44.0