feat: moved libk stuff to libk folder
This commit is contained in:
37
kernel/libk/kprint.c
Normal file
37
kernel/libk/kprint.c
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by rick on 28-01-21.
|
||||
//
|
||||
|
||||
#include "kprint.h"
|
||||
|
||||
#define MAX_HANDLERS 8
|
||||
|
||||
kprint_handler handlers[MAX_HANDLERS] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
void kprint_register(kprint_handler handler) {
|
||||
for (int i = 0; i < MAX_HANDLERS; ++i) {
|
||||
if (handlers[i] == NULL) {
|
||||
handlers[i] = handler;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// todo handle
|
||||
}
|
||||
|
||||
void kprint(const char *msg) {
|
||||
for (int i = 0; i < MAX_HANDLERS; ++i) {
|
||||
if (handlers[i] == NULL) {
|
||||
continue;
|
||||
}
|
||||
handlers[i](msg);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user