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 #include <kern/kclock.h>
12 #include <kern/trap.h>
13 #include <kern/sched.h>
14 #include <kern/picirq.h>
19 extern char edata
[], end
[];
21 // Before doing anything else, complete the ELF loading process.
22 // Clear the uninitialized global data (BSS) section of our program.
23 // This ensures that all static/global variables start out zero.
24 memset(edata
, 0, end
- edata
);
26 // Initialize the console.
27 // Can't call cprintf until after we do this!
30 cprintf("6828 decimal is %o octal!\n", 6828);
32 // Lab 2 memory management initialization functions
36 // Lab 3 user environment initialization functions
40 // Lab 4 multitasking initialization functions
44 // Should always have an idle process as first one.
45 ENV_CREATE(user_idle
);
48 // Don't touch -- used by grading script!
49 ENV_CREATE2(TEST
, TESTSIZE
)
51 // Touch all you want.
52 ENV_CREATE(user_forktree
);
55 // Schedule and run the first user environment!
61 * Variable panicstr contains argument to first call to panic; used as flag
62 * to indicate that the kernel has already called panic.
64 static const char *panicstr
;
67 * Panic is called on unresolvable fatal errors.
68 * It prints "panic: mesg", and then enters the kernel monitor.
71 _panic(const char *file
, int line
, const char *fmt
,...)
80 cprintf("kernel panic at %s:%d: ", file
, line
);
86 /* break into the kernel monitor */
91 /* like panic, but don't */
93 _warn(const char *file
, int line
, const char *fmt
,...)
98 cprintf("kernel warning at %s:%d: ", file
, line
);