Kernel panic
This commit is contained in:
@@ -3,24 +3,24 @@
|
||||
#include <kernel/drivers/terminal/terminal.h>
|
||||
|
||||
void loggerLog(char* str) {
|
||||
write(" ");
|
||||
writeln(str);
|
||||
Write(" ");
|
||||
Writeln(str);
|
||||
}
|
||||
|
||||
void loggerOK(char* str) {
|
||||
write("[");
|
||||
setFGColour(VGA_BRIGHT_GREEN);
|
||||
write(" OK ");
|
||||
setFGColour(VGA_WHITE);
|
||||
write("] ");
|
||||
writeln(str);
|
||||
Write("[");
|
||||
SetFGColour(VGA_BRIGHT_GREEN);
|
||||
Write(" OK ");
|
||||
SetFGColour(VGA_WHITE);
|
||||
Write("] ");
|
||||
Writeln(str);
|
||||
}
|
||||
|
||||
void loggerFailed(char* str) {
|
||||
write("[");
|
||||
setFGColour(VGA_BRIGHT_RED);
|
||||
write("FAILED");
|
||||
setFGColour(VGA_WHITE);
|
||||
write("] ");
|
||||
writeln(str);
|
||||
Write("[");
|
||||
SetFGColour(VGA_BRIGHT_RED);
|
||||
Write("FAILED");
|
||||
SetFGColour(VGA_WHITE);
|
||||
Write("] ");
|
||||
Writeln(str);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ void reverse(char *s) {
|
||||
}
|
||||
|
||||
|
||||
char* itoa(int n, char s[]) {
|
||||
char* itoa(int n, char* s) {
|
||||
int i = 0;
|
||||
bool isNegative = false;
|
||||
|
||||
@@ -58,3 +58,28 @@ char* itoa(int n, char s[]) {
|
||||
reverse(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
int hexlen(int n) {
|
||||
if (!n) return 1;
|
||||
|
||||
int ret = 0;
|
||||
for (; n; n >>= 4) {
|
||||
++ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
char* itohx(int n, char* s) {
|
||||
const char hex_lookup[] = "0123456789ABCDEF";
|
||||
int len = hexlen(n);
|
||||
|
||||
if (len & 1) {
|
||||
*s++ = '0';
|
||||
}
|
||||
s[len] = '\0';
|
||||
|
||||
for (--len; len >= 0; n >>= 4, --len) {
|
||||
s[len] = hex_lookup[n & 0xf];
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
void swap(int* a, int* b);
|
||||
void reverse(char* s);
|
||||
char* itoa(int i, char s[] = "");
|
||||
char* itoa (int i, char* s = "");
|
||||
char* itohx(int i, char* s = "");
|
||||
|
||||
Reference in New Issue
Block a user