Intermediate boot verbosity level EXTRA (2), MAX moved to 3

This commit is contained in:
Erik van der Kouwe 2010-05-10 18:07:59 +00:00
parent d4188dcd5c
commit b7bf2733d6
5 changed files with 42 additions and 39 deletions

View file

@ -30,10 +30,11 @@
static int block_size = 0; static int block_size = 0;
static int verboseboot = VERBOSEBOOT_QUIET; static int verboseboot = VERBOSEBOOT_QUIET;
#define DEBUGBASIC(params) do { \ #define DEBUG_PRINT(params, level) do { \
if (verboseboot >= VERBOSEBOOT_BASIC) printf params; } while (0) if (verboseboot >= (level)) printf params; } while (0)
#define DEBUGMAX(params) do { \ #define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC)
if (verboseboot >= VERBOSEBOOT_MAX) printf params; } while (0) #define DEBUGEXTRA(params) DEBUG_PRINT(params, VERBOSEBOOT_EXTRA)
#define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX)
extern int serial_line; extern int serial_line;
extern u16_t vid_port; /* Video i/o port. */ 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) 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=0x%lx; limit=0x%lx; size=%lx\n",
*addr, limit, size)); *addr, limit, size));
errno= ENOMEM; errno= ENOMEM;
@ -494,7 +495,7 @@ void exec_image(char *image)
procp= &process[i]; procp= &process[i];
/* Read header. */ /* Read header. */
DEBUGMAX(("Reading header... ")); DEBUGEXTRA(("Reading header... "));
for (;;) { for (;;) {
if ((buf= get_sector(vsec++)) == nil) return; if ((buf= get_sector(vsec++)) == nil) return;
@ -508,7 +509,7 @@ void exec_image(char *image)
/* Bad label, skip this process. */ /* Bad label, skip this process. */
vsec+= proc_size(&hdr); vsec+= proc_size(&hdr);
} }
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
/* Sanity check: an 8086 can't run a 386 kernel. */ /* Sanity check: an 8086 can't run a 386 kernel. */
if (hdr.process.a_cpu == A_I80386 && processor < 386) { 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 /* Save a copy of the header for the kernel, with a_syms
* misused as the address where the process is loaded at. * 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)); aout + i * A_MINHDR, mon2abs(&hdr.process), A_MINHDR));
hdr.process.a_syms= addr; hdr.process.a_syms= addr;
raw_copy(aout + i * A_MINHDR, mon2abs(&hdr.process), A_MINHDR); raw_copy(aout + i * A_MINHDR, mon2abs(&hdr.process), A_MINHDR);
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
if (!banner) { if (!banner) {
DEBUGBASIC((" cs ds text data bss")); DEBUGBASIC((" cs ds text data bss"));
@ -547,7 +548,7 @@ void exec_image(char *image)
} }
/* Segment sizes. */ /* 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_text, hdr.process.a_data,
hdr.process.a_bss, hdr.process.a_flags)); 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. */ /* Separate I&D: two segments. Common I&D: only one. */
if (hdr.process.a_flags & A_SEP) { if (hdr.process.a_flags & A_SEP) {
/* Read the text segment. */ /* 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)); vsec, a_text, addr, limit));
if (!get_segment(&vsec, &a_text, &addr, limit)) return; 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", "addr=0x%lx\n",
vsec, a_text, addr)); vsec, a_text, addr));
@ -593,10 +594,10 @@ void exec_image(char *image)
} }
/* Read the data segment. */ /* 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)); vsec, a_data, addr, limit));
if (!get_segment(&vsec, &a_data, &addr, limit)) return; 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", "addr=0x%lx\n",
vsec, a_data, addr)); vsec, a_data, addr));
@ -618,10 +619,10 @@ void exec_image(char *image)
a_bss-= n; a_bss-= n;
/* Zero out bss. */ /* 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; } if (addr + n > limit) { errno= ENOMEM; return; }
raw_clear(addr, n); raw_clear(addr, n);
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
addr+= n; addr+= n;
/* And the number of stack clicks. */ /* And the number of stack clicks. */
@ -671,9 +672,9 @@ void exec_image(char *image)
} }
/* Patch sizes, etc. into kernel data. */ /* Patch sizes, etc. into kernel data. */
DEBUGMAX(("patch_sizes()... ")); DEBUGEXTRA(("patch_sizes()... "));
patch_sizes(); patch_sizes();
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
#if !DOS #if !DOS
if (!(k_flags & K_MEML)) { if (!(k_flags & K_MEML)) {
@ -683,31 +684,31 @@ void exec_image(char *image)
#endif #endif
/* Run the trailer function just before starting Minix. */ /* Run the trailer function just before starting Minix. */
DEBUGMAX(("run_trailer()... ")); DEBUGEXTRA(("run_trailer()... "));
if (!run_trailer()) { errno= 0; return; } if (!run_trailer()) { errno= 0; return; }
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
/* Translate the boot parameters to what Minix likes best. */ /* 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; } if (!params2params(params, sizeof(params))) { errno= 0; return; }
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
/* Set the video to the required mode. */ /* Set the video to the required mode. */
if ((console= b_value("console")) == nil || (mode= a2x(console)) == 0) { if ((console= b_value("console")) == nil || (mode= a2x(console)) == 0) {
mode= strcmp(b_value("chrome"), "color") == 0 ? COLOR_MODE : mode= strcmp(b_value("chrome"), "color") == 0 ? COLOR_MODE :
MONO_MODE; MONO_MODE;
} }
DEBUGMAX(("set_mode(%d)... ", mode)); DEBUGEXTRA(("set_mode(%d)... ", mode));
set_mode(mode); set_mode(mode);
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
/* Close the disk. */ /* Close the disk. */
DEBUGMAX(("dev_close()... ")); DEBUGEXTRA(("dev_close()... "));
(void) dev_close(); (void) dev_close();
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
/* Minix. */ /* 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].entry, process[KERNEL_IDX].cs,
process[KERNEL_IDX].ds, params, sizeof(params), aout)); process[KERNEL_IDX].ds, params, sizeof(params), aout));
minix(process[KERNEL_IDX].entry, process[KERNEL_IDX].cs, minix(process[KERNEL_IDX].entry, process[KERNEL_IDX].cs,

View file

@ -179,7 +179,8 @@
/* Values for the "verbose" boot monitor variable */ /* Values for the "verbose" boot monitor variable */
#define VERBOSEBOOT_QUIET 0 #define VERBOSEBOOT_QUIET 0
#define VERBOSEBOOT_BASIC 1 #define VERBOSEBOOT_BASIC 1
#define VERBOSEBOOT_MAX 2 #define VERBOSEBOOT_EXTRA 2
#define VERBOSEBOOT_MAX 3
#define VERBOSEBOOTVARNAME "verbose" #define VERBOSEBOOTVARNAME "verbose"
#endif /* _MINIX_CONST_H */ #endif /* _MINIX_CONST_H */

View file

@ -67,6 +67,7 @@
#define DEBUG_PRINT(params, level) do { \ #define DEBUG_PRINT(params, level) do { \
if (verboseboot >= (level)) printf params; } while (0) if (verboseboot >= (level)) printf params; } while (0)
#define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC) #define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC)
#define DEBUGEXTRA(params) DEBUG_PRINT(params, VERBOSEBOOT_EXTRA)
#define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX) #define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX)
#endif #endif

View file

@ -41,7 +41,7 @@ PUBLIC void main(void)
/* Global value to test segment sanity. */ /* Global value to test segment sanity. */
magictest = MAGICTEST; magictest = MAGICTEST;
DEBUGMAX(("main()\n")); DEBUGEXTRA(("main()\n"));
/* Clear the process table. Anounce each slot as empty and set up mappings /* 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 * 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; int ipc_to_m, kcalls;
ip = &image[i]; /* process' attributes */ 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 */ rp = proc_addr(ip->proc_nr); /* get process pointer */
ip->endpoint = rp->p_endpoint; /* ipc endpoint */ ip->endpoint = rp->p_endpoint; /* ipc endpoint */
rp->p_scheduler = NULL; /* no user space scheduler */ 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); if (rp->p_nr < 0) RTS_SET(rp, RTS_PROC_STOP);
RTS_UNSET(rp, RTS_SLOT_FREE); /* remove RTS_SLOT_FREE and schedule */ RTS_UNSET(rp, RTS_SLOT_FREE); /* remove RTS_SLOT_FREE and schedule */
alloc_segments(rp); alloc_segments(rp);
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
} }
/* Architecture-dependent initialization. */ /* Architecture-dependent initialization. */
DEBUGMAX(("arch_init()... ")); DEBUGEXTRA(("arch_init()... "));
arch_init(); arch_init();
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
/* System and processes initialization */ /* System and processes initialization */
DEBUGMAX(("system_init()... ")); DEBUGEXTRA(("system_init()... "));
system_init(); system_init();
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
#if SPROFILE #if SPROFILE
sprofiling = 0; /* we're not profiling until instructed to */ sprofiling = 0; /* we're not profiling until instructed to */
@ -251,9 +251,9 @@ PUBLIC void main(void)
FIXME("PROC check enabled"); FIXME("PROC check enabled");
#endif #endif
DEBUGMAX(("cycles_accounting_init()... ")); DEBUGEXTRA(("cycles_accounting_init()... "));
cycles_accounting_init(); cycles_accounting_init();
DEBUGMAX(("done\n")); DEBUGEXTRA(("done\n"));
assert(runqueues_ok()); assert(runqueues_ok());

View file

@ -46,7 +46,7 @@ PUBLIC void cstart(
if ((value = get_value(params_buffer, VERBOSEBOOTVARNAME))) if ((value = get_value(params_buffer, VERBOSEBOOTVARNAME)))
verboseboot = atoi(value); verboseboot = atoi(value);
DEBUGMAX(("cstart\n")); DEBUGEXTRA(("cstart\n"));
/* Record miscellaneous information for user-space servers. */ /* Record miscellaneous information for user-space servers. */
kinfo.nr_procs = NR_PROCS; kinfo.nr_procs = NR_PROCS;
@ -106,7 +106,7 @@ PUBLIC void cstart(
* reload selectors and call main(). * 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); intr_init(INTS_MINIX, 0);
} }