Modestus Moon OS  R4
CS 450 project
system.c
Go to the documentation of this file.
1 #include <string.h>
2 #include <system.h>
3 
4 #include <core/serial.h>
5 
6 /*
7  Procedure..: klogv
8  Description..: Kernel log messages. Sent to active
9  serial device.
10 */
11 void klogv(const char *msg)
12 {
13  char logmsg[64] = {'\0'}, prefix[] = "klogv: ";
14  strcat(logmsg, prefix);
15  strcat(logmsg, msg);
16  serial_println(logmsg);
17 }
18 
19 /*
20  Procedure..: kpanic
21  Description..: Kernel panic. Prints an error message
22  and halts.
23 */
24 void kpanic(const char *msg)
25 {
26  cli(); //disable interrupts
27  char logmsg[64] = {'\0'}, prefix[] = "Panic: ";
28  strcat(logmsg, prefix);
29  strcat(logmsg, msg);
30  klogv(logmsg);
31  hlt(); //halt
32 }
#define hlt()
Definition: system.h:17
void klogv(const char *msg)
Definition: system.c:11
#define cli()
Definition: system.h:15
void kpanic(const char *msg)
Definition: system.c:24
char * strcat(char *s1, const char *s2)
strcat concatenates the contents of one string onto another.
Definition: string.c:101
int serial_println(const char *msg)
Definition: serial.c:44