Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Kernel/Kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ void PrintKernel(const char *str){
}
}

void PrintKernelHex(int num) {
void PrintKernelHex(uint64_t num) {
PrintKernel("0x");
if (num == 0) {
PrintKernel("0");
return;
}
char buf[16];
int i = 0;
char hex[] = "0123456789ABCDEF";
const char hex[] = "0123456789ABCDEF";

while (num > 0 && i < 15) {
buf[i++] = hex[num % 16];
Expand All @@ -66,7 +66,7 @@ void PrintKernelHex(int num) {
buf[i] = '\0';
// Reverse
for (int j = 0; j < i/2; j++) {
char temp = buf[j];
const char temp = buf[j];
buf[j] = buf[i-1-j];
buf[i-1-j] = temp;
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ extern int CurrentColumn;
void ClearScreen();
void PrintKernel(const char *str);
void PrintKernelInt(int num);
void PrintKernelHex(int hex);
void PrintKernelHex(uint64_t hex);
void PrintKernelAt(const char *str, int line, int col);
#endif
4 changes: 2 additions & 2 deletions Kernel/Panic.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
void __attribute__((noreturn)) Panic(const char* message);
void __attribute__((noreturn)) PanicWithCode(const char* message, uint64_t error_code);

// Assert macro
#define STRINGIFY(x) #x
#define ASSERT(condition) \
do { \
if (!(condition)) { \
Panic("Assertion failed: " #condition " at " __FILE__ ":" __LINE__); \
Panic("Assertion failed: " #condition " at " __FILE__ ":" STRINGIFY(__LINE__); \
} \
} while(0)

Expand Down