2022-08-20 00:54:34 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <limine.h>
|
|
|
|
|
|
|
|
// The Limine requests can be placed anywhere, but it is important that
|
|
|
|
// the compiler does not optimise them away, so, usually, they should
|
|
|
|
// be made volatile or equivalent.
|
|
|
|
|
2022-08-20 01:21:36 +01:00
|
|
|
static volatile struct limine_module_request module_request = {
|
|
|
|
.id = LIMINE_MODULE_REQUEST,
|
|
|
|
.revision = 0
|
|
|
|
};
|
|
|
|
|
2022-08-20 00:54:34 +01:00
|
|
|
static volatile struct limine_terminal_request terminal_request = {
|
|
|
|
.id = LIMINE_TERMINAL_REQUEST,
|
|
|
|
.revision = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
static void done(void) {
|
|
|
|
for (;;) {
|
|
|
|
__asm__("hlt");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-20 01:21:36 +01:00
|
|
|
struct CKernel {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-08-20 00:54:34 +01:00
|
|
|
// The following will be our kernel's entry point.
|
|
|
|
void _start(void) {
|
|
|
|
// Ensure we got a terminal
|
|
|
|
if (terminal_request.response == NULL
|
|
|
|
|| terminal_request.response->terminal_count < 1) {
|
|
|
|
done();
|
|
|
|
}
|
|
|
|
|
|
|
|
// We should now be able to call the Limine terminal to print out
|
|
|
|
// a simple "Hello World" to screen.
|
|
|
|
struct limine_terminal *terminal = terminal_request.response->terminals[0];
|
|
|
|
terminal_request.response->write(terminal, "Hello World", 11);
|
|
|
|
|
2022-08-20 01:21:36 +01:00
|
|
|
struct limine_file *kernel = module_request.response->modules[0];
|
|
|
|
struct CKernel *CKernel = kernel->address;
|
|
|
|
|
2022-08-20 00:54:34 +01:00
|
|
|
// We're done, just hang...
|
|
|
|
done();
|
|
|
|
}
|