feat/kernel: Added IDT
This commit is contained in:
parent
248879c099
commit
af7599a266
15 changed files with 412 additions and 19 deletions
|
@ -1,3 +1,4 @@
|
|||
/* EMK 1.0 Copyright (c) 2025 Piraterna */
|
||||
#include <dev/serial.h>
|
||||
#include <util/kprintf.h>
|
||||
|
||||
|
@ -24,5 +25,26 @@ int kprintf(const char *fmt, ...)
|
|||
}
|
||||
|
||||
va_end(args);
|
||||
return length;
|
||||
}
|
||||
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
int length = vsnprintf(buf, size, fmt, args);
|
||||
va_end(args);
|
||||
return length;
|
||||
}
|
||||
|
||||
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
||||
{
|
||||
int length = npf_vsnprintf(buf, size, fmt, args);
|
||||
|
||||
if (length >= (int)size)
|
||||
{
|
||||
buf[size - 1] = '\0';
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
|
@ -1,7 +1,15 @@
|
|||
/* EMK 1.0 Copyright (c) 2025 Piraterna */
|
||||
#ifndef KPRINTF_H
|
||||
#define KPRINTF_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Minimal kprintf using nanoprintf, see external/nanoprintf.h */
|
||||
int kprintf(const char *fmt, ...);
|
||||
|
||||
/* Careful with these */
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...);
|
||||
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
||||
|
||||
#endif // KPRINTF_H
|
|
@ -1,8 +1,10 @@
|
|||
/* EMK 1.0 Copyright (c) 2025 Piraterna */
|
||||
#ifndef LOG_H
|
||||
#define LOG_H
|
||||
|
||||
#include <util/kprintf.h>
|
||||
|
||||
#define early(fmt, ...) kprintf("early: " fmt "\n", ##__VA_ARGS__)
|
||||
#define log_early(fmt, ...) kprintf("early: " fmt "\n", ##__VA_ARGS__)
|
||||
#define log_panic(fmt, ...) kprintf("panic: " fmt "\n", ##__VA_ARGS__)
|
||||
|
||||
#endif // LOG_H
|
Loading…
Add table
Add a link
Reference in a new issue