use the verbose=2 boot monitor setting to get extensive output for debugging
This commit is contained in:
parent
df60646f98
commit
ff835e0e35
|
@ -419,6 +419,11 @@ static void restore_screen(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DEBUGBASIC(params) do { \
|
||||||
|
if (verbose >= VERBOSEBOOT_BASIC) printf params; } while (0)
|
||||||
|
#define DEBUGMAX(params) do { \
|
||||||
|
if (verbose >= VERBOSEBOOT_MAX) printf params; } while (0)
|
||||||
|
|
||||||
void exec_image(char *image)
|
void exec_image(char *image)
|
||||||
/* Get a Minix image into core, patch it up and execute. */
|
/* Get a Minix image into core, patch it up and execute. */
|
||||||
{
|
{
|
||||||
|
@ -435,13 +440,13 @@ void exec_image(char *image)
|
||||||
char params[SECTOR_SIZE];
|
char params[SECTOR_SIZE];
|
||||||
extern char *sbrk(int);
|
extern char *sbrk(int);
|
||||||
char *verb;
|
char *verb;
|
||||||
int verbose = 0;
|
int verbose = VERBOSEBOOT_QUIET;
|
||||||
|
|
||||||
/* The stack is pretty deep here, so check if heap and stack collide. */
|
/* The stack is pretty deep here, so check if heap and stack collide. */
|
||||||
(void) sbrk(0);
|
(void) sbrk(0);
|
||||||
|
|
||||||
if ((verb= b_value("verbose")) != nil && a2l(verb) > 0)
|
if ((verb= b_value(VERBOSEBOOTVARNAME)) != nil)
|
||||||
verbose = 1;
|
verbose = a2l(verb);
|
||||||
|
|
||||||
printf("\nLoading ");
|
printf("\nLoading ");
|
||||||
pretty_image(image);
|
pretty_image(image);
|
||||||
|
@ -471,6 +476,7 @@ void exec_image(char *image)
|
||||||
procp= &process[i];
|
procp= &process[i];
|
||||||
|
|
||||||
/* Read header. */
|
/* Read header. */
|
||||||
|
DEBUGMAX(("Reading header... "));
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ((buf= get_sector(vsec++)) == nil) return;
|
if ((buf= get_sector(vsec++)) == nil) return;
|
||||||
|
|
||||||
|
@ -484,6 +490,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"));
|
||||||
|
|
||||||
/* 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) {
|
||||||
|
@ -502,13 +509,16 @@ 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%x, 0x%x)... ",
|
||||||
|
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"));
|
||||||
|
|
||||||
if (!banner && verbose) {
|
if (!banner) {
|
||||||
printf(" cs ds text data bss");
|
DEBUGBASIC((" cs ds text data bss"));
|
||||||
if (k_flags & K_CHMEM) printf(" stack");
|
if (k_flags & K_CHMEM) DEBUGBASIC((" stack"));
|
||||||
putch('\n');
|
DEBUGBASIC(("\n"));
|
||||||
banner= 1;
|
banner= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +546,11 @@ 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%x, &a_text, 0x%x, 0x%x)... ",
|
||||||
|
vsec, addr, limit));
|
||||||
if (!get_segment(&vsec, &a_text, &addr, limit)) return;
|
if (!get_segment(&vsec, &a_text, &addr, limit)) return;
|
||||||
|
DEBUGMAX(("vsec=0x%x a_text=0x%x addr=0x%x\n",
|
||||||
|
vsec, a_text, addr));
|
||||||
|
|
||||||
/* The data segment follows. */
|
/* The data segment follows. */
|
||||||
procp->ds= addr;
|
procp->ds= addr;
|
||||||
|
@ -550,19 +564,19 @@ void exec_image(char *image)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the data segment. */
|
/* Read the data segment. */
|
||||||
|
DEBUGMAX(("get_segment(0x%x, &a_data, 0x%x, 0x%x)... ",
|
||||||
|
vsec, addr, limit));
|
||||||
if (!get_segment(&vsec, &a_data, &addr, limit)) return;
|
if (!get_segment(&vsec, &a_data, &addr, limit)) return;
|
||||||
|
DEBUGMAX(("vsec=0x%x a_data=0x%x addr=0x%x\n",
|
||||||
|
vsec, a_data, addr));
|
||||||
|
|
||||||
/* Make space for bss and stack unless... */
|
/* Make space for bss and stack unless... */
|
||||||
if (i != KERNEL_IDX && (k_flags & K_CLAIM)) a_bss= a_stack= 0;
|
if (i != KERNEL_IDX && (k_flags & K_CLAIM)) a_bss= a_stack= 0;
|
||||||
|
|
||||||
if(verbose) {
|
DEBUGBASIC(("%07lx %07lx %8ld %8ld %8ld",
|
||||||
printf("%07lx %07lx %8ld %8ld %8ld",
|
procp->cs, procp->ds, hdr.process.a_text,
|
||||||
procp->cs, procp->ds,
|
hdr.process.a_data, hdr.process.a_bss));
|
||||||
hdr.process.a_text, hdr.process.a_data,
|
if (k_flags & K_CHMEM) DEBUGBASIC((" %8ld", a_stack));
|
||||||
hdr.process.a_bss
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ((k_flags & K_CHMEM) && verbose) printf(" %8ld", a_stack);
|
|
||||||
|
|
||||||
/* Note that a_data may be negative now, but we can look at it
|
/* Note that a_data may be negative now, but we can look at it
|
||||||
* as -a_data bss bytes.
|
* as -a_data bss bytes.
|
||||||
|
@ -575,7 +589,9 @@ void exec_image(char *image)
|
||||||
|
|
||||||
/* Zero out bss. */
|
/* Zero out bss. */
|
||||||
if (addr + n > limit) { errno= ENOMEM; return; }
|
if (addr + n > limit) { errno= ENOMEM; return; }
|
||||||
|
DEBUGMAX(("\nraw_clear(0x%x, 0x%x)... ", addr, n));
|
||||||
raw_clear(addr, n);
|
raw_clear(addr, n);
|
||||||
|
DEBUGMAX(("done\n"));
|
||||||
addr+= n;
|
addr+= n;
|
||||||
|
|
||||||
/* And the number of stack clicks. */
|
/* And the number of stack clicks. */
|
||||||
|
@ -589,7 +605,7 @@ void exec_image(char *image)
|
||||||
/* Process endpoint. */
|
/* Process endpoint. */
|
||||||
procp->end= addr;
|
procp->end= addr;
|
||||||
|
|
||||||
if(verbose)
|
if (verbose >= VERBOSEBOOT_BASIC)
|
||||||
printf(" %s\n", hdr.name);
|
printf(" %s\n", hdr.name);
|
||||||
else {
|
else {
|
||||||
u32_t mem;
|
u32_t mem;
|
||||||
|
@ -605,7 +621,7 @@ void exec_image(char *image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!verbose)
|
if (verbose < VERBOSEBOOT_BASIC)
|
||||||
printf("(%dk)\n", totalmem/1024);
|
printf("(%dk)\n", totalmem/1024);
|
||||||
|
|
||||||
if ((n_procs= i) == 0) {
|
if ((n_procs= i) == 0) {
|
||||||
|
@ -622,7 +638,9 @@ void exec_image(char *image)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Patch sizes, etc. into kernel data. */
|
/* Patch sizes, etc. into kernel data. */
|
||||||
|
DEBUGMAX(("patch_sizes()... "));
|
||||||
patch_sizes();
|
patch_sizes();
|
||||||
|
DEBUGMAX(("done\n"));
|
||||||
|
|
||||||
#if !DOS
|
#if !DOS
|
||||||
if (!(k_flags & K_MEML)) {
|
if (!(k_flags & K_MEML)) {
|
||||||
|
@ -632,22 +650,33 @@ 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()... "));
|
||||||
if (!run_trailer()) { errno= 0; return; }
|
if (!run_trailer()) { errno= 0; return; }
|
||||||
|
DEBUGMAX(("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)));
|
||||||
if (!params2params(params, sizeof(params))) { errno= 0; return; }
|
if (!params2params(params, sizeof(params))) { errno= 0; return; }
|
||||||
|
DEBUGMAX(("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));
|
||||||
set_mode(mode);
|
set_mode(mode);
|
||||||
|
DEBUGMAX(("done\n"));
|
||||||
|
|
||||||
/* Close the disk. */
|
/* Close the disk. */
|
||||||
|
DEBUGMAX(("dev_close()... "));
|
||||||
(void) dev_close();
|
(void) dev_close();
|
||||||
|
DEBUGMAX(("done\n"));
|
||||||
|
|
||||||
/* Minix. */
|
/* Minix. */
|
||||||
|
DEBUGMAX(("minix(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\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,
|
minix(process[KERNEL_IDX].entry, process[KERNEL_IDX].cs,
|
||||||
process[KERNEL_IDX].ds, params, sizeof(params), aout);
|
process[KERNEL_IDX].ds, params, sizeof(params), aout);
|
||||||
|
|
||||||
|
|
|
@ -146,3 +146,9 @@
|
||||||
#define CHECK_IO_PORT 0x20 /* check if I/O request is allowed */
|
#define CHECK_IO_PORT 0x20 /* check if I/O request is allowed */
|
||||||
#define CHECK_IRQ 0x40 /* check if IRQ can be used */
|
#define CHECK_IRQ 0x40 /* check if IRQ can be used */
|
||||||
#define CHECK_MEM 0x80 /* check if (VM) mem map request is allowed */
|
#define CHECK_MEM 0x80 /* check if (VM) mem map request is allowed */
|
||||||
|
|
||||||
|
/* Values for the "verbose" boot monitor variable */
|
||||||
|
#define VERBOSEBOOT_QUIET 0
|
||||||
|
#define VERBOSEBOOT_BASIC 1
|
||||||
|
#define VERBOSEBOOT_MAX 2
|
||||||
|
#define VERBOSEBOOTVARNAME "verbose"
|
||||||
|
|
|
@ -82,4 +82,11 @@
|
||||||
#define BOOT_VERBOSE(x)
|
#define BOOT_VERBOSE(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _SYSTEM
|
||||||
|
#define DEBUG_PRINT(params, level) do { \
|
||||||
|
if (verboseboot >= (level)) kprintf params; } while (0)
|
||||||
|
#define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC)
|
||||||
|
#define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* DEBUG_H */
|
#endif /* DEBUG_H */
|
||||||
|
|
|
@ -47,6 +47,7 @@ EXTERN int minix_panicing;
|
||||||
EXTERN int locklevel;
|
EXTERN int locklevel;
|
||||||
EXTERN char fpu_presence;
|
EXTERN char fpu_presence;
|
||||||
EXTERN char osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
|
EXTERN char osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
|
||||||
|
EXTERN int verboseboot; /* verbose boot, init'ed in cstart */
|
||||||
#define MAGICTEST 0xC0FFEE23
|
#define MAGICTEST 0xC0FFEE23
|
||||||
EXTERN u32_t magictest; /* global magic number */
|
EXTERN u32_t magictest; /* global magic number */
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ PUBLIC void main()
|
||||||
/* Global value to test segment sanity. */
|
/* Global value to test segment sanity. */
|
||||||
magictest = MAGICTEST;
|
magictest = MAGICTEST;
|
||||||
|
|
||||||
|
DEBUGMAX(("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
|
||||||
* privilege structures for the system processes.
|
* privilege structures for the system processes.
|
||||||
|
@ -75,6 +77,7 @@ PUBLIC void main()
|
||||||
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));
|
||||||
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_max_priority = ip->priority; /* max scheduling priority */
|
rp->p_max_priority = ip->priority; /* max scheduling priority */
|
||||||
|
@ -203,15 +206,22 @@ PUBLIC void main()
|
||||||
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Architecture-dependent initialization. */
|
/* Architecture-dependent initialization. */
|
||||||
|
DEBUGMAX(("arch_init()... "));
|
||||||
arch_init();
|
arch_init();
|
||||||
|
DEBUGMAX(("done\n"));
|
||||||
|
|
||||||
/* System and processes initialization */
|
/* System and processes initialization */
|
||||||
|
DEBUGMAX(("system_init()... "));
|
||||||
system_init();
|
system_init();
|
||||||
|
DEBUGMAX(("done\n"));
|
||||||
/* Initialize timers handling */
|
/* Initialize timers handling */
|
||||||
|
DEBUGMAX(("clock_init()... "));
|
||||||
clock_init();
|
clock_init();
|
||||||
|
DEBUGMAX(("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,7 +261,9 @@ PUBLIC void main()
|
||||||
FIXME("PROC check enabled");
|
FIXME("PROC check enabled");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
DEBUGMAX(("cycles_accounting_init()... "));
|
||||||
cycles_accounting_init();
|
cycles_accounting_init();
|
||||||
|
DEBUGMAX(("done\n"));
|
||||||
|
|
||||||
restart();
|
restart();
|
||||||
NOT_REACHABLE;
|
NOT_REACHABLE;
|
||||||
|
|
|
@ -39,6 +39,12 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */
|
||||||
/* Copy the boot parameters to the local buffer. */
|
/* Copy the boot parameters to the local buffer. */
|
||||||
arch_get_params(params_buffer, sizeof(params_buffer));
|
arch_get_params(params_buffer, sizeof(params_buffer));
|
||||||
|
|
||||||
|
/* determine verbosity */
|
||||||
|
if ((value = get_value(params_buffer, VERBOSEBOOTVARNAME)))
|
||||||
|
verboseboot = atoi(value);
|
||||||
|
|
||||||
|
DEBUGMAX(("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;
|
||||||
kinfo.nr_tasks = NR_TASKS;
|
kinfo.nr_tasks = NR_TASKS;
|
||||||
|
@ -97,6 +103,7 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */
|
||||||
* reload selectors and call main().
|
* reload selectors and call main().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DEBUGMAX(("intr_init(%d, 0)\n", INTS_MINIX));
|
||||||
intr_init(INTS_MINIX, 0);
|
intr_init(INTS_MINIX, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue