1 /* See COPYRIGHT for copyright information. */
4 #include <inc/string.h>
5 #include <inc/assert.h>
7 #include <kern/monitor.h>
8 #include <kern/console.h>
10 // Test the stack backtrace function (lab 1 only)
14 cprintf("entering test_backtrace %d\n", x
);
18 mon_backtrace(0, 0, 0);
19 cprintf("leaving test_backtrace %d\n", x
);
25 extern char edata
[], end
[];
27 // Before doing anything else, complete the ELF loading process.
28 // Clear the uninitialized global data (BSS) section of our program.
29 // This ensures that all static/global variables start out zero.
30 memset(edata
, 0, end
- edata
);
32 // Initialize the console.
33 // Can't call cprintf until after we do this!
36 cprintf("6828 decimal is %o octal!\n", 6828);
44 // Test the stack backtrace function (lab 1 only)
47 // Drop into the kernel monitor.
54 * Variable panicstr contains argument to first call to panic; used as flag
55 * to indicate that the kernel has already called panic.
57 static const char *panicstr
;
60 * Panic is called on unresolvable fatal errors.
61 * It prints "panic: mesg", and then enters the kernel monitor.
64 _panic(const char *file
, int line
, const char *fmt
,...)
73 cprintf("kernel panic at %s:%d: ", file
, line
);
79 /* break into the kernel monitor */
84 /* like panic, but don't */
86 _warn(const char *file
, int line
, const char *fmt
,...)
91 cprintf("kernel warning at %s:%d: ", file
, line
);