2017-11-04 07:45:48 -04:00
|
|
|
#include "console.h"
|
2017-11-03 22:32:23 -04:00
|
|
|
#include "logger.h"
|
|
|
|
#include "protected.h"
|
2017-11-04 01:31:37 -04:00
|
|
|
#include "paging.h"
|
2017-11-03 22:32:23 -04:00
|
|
|
#include "timer.h"
|
2017-11-04 08:01:10 -04:00
|
|
|
#include "kprintf.h"
|
2017-11-03 22:32:23 -04:00
|
|
|
|
2017-11-04 06:38:28 -04:00
|
|
|
#include <kernelmq/info.h>
|
|
|
|
#include <kernelmq/stdlib.h>
|
|
|
|
|
|
|
|
static struct KernelMQ_Info kinfo;
|
|
|
|
|
2017-11-03 22:32:23 -04:00
|
|
|
static void on_timer();
|
|
|
|
|
2017-11-04 06:38:28 -04:00
|
|
|
void main(const struct KernelMQ_Info *const kinfo_ptr)
|
2017-11-03 22:32:23 -04:00
|
|
|
{
|
2017-11-04 07:45:48 -04:00
|
|
|
console_initialize();
|
|
|
|
|
2017-11-04 06:38:28 -04:00
|
|
|
kmemset(&kinfo, 0, sizeof(struct KernelMQ_Info));
|
|
|
|
|
2017-11-04 08:01:10 -04:00
|
|
|
if (!kernelmq_info_validate_and_copy(&kinfo, kinfo_ptr)) {
|
|
|
|
logger_fail("Invalid kernel information. Halt.");
|
2017-11-04 06:38:28 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-11-04 08:01:10 -04:00
|
|
|
kprintf("Kernel command line: %s\n", kinfo.cmdline);
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < kinfo.modules_count; ++i) {
|
|
|
|
struct KernelMQ_Info_Module *module = &kinfo.modules[i];
|
|
|
|
|
|
|
|
kprintf(
|
|
|
|
"Module at 0x%x, size 0x%x, command line: %s\n",
|
|
|
|
module->base,
|
|
|
|
module->size,
|
|
|
|
module->cmdline
|
|
|
|
);
|
|
|
|
}
|
2017-11-04 06:38:28 -04:00
|
|
|
|
2017-11-03 22:32:23 -04:00
|
|
|
protected_initialize();
|
|
|
|
|
2017-11-04 01:31:37 -04:00
|
|
|
// paging_initialize();
|
|
|
|
|
2017-11-03 22:32:23 -04:00
|
|
|
timer_register_handler(on_timer);
|
|
|
|
timer_initialize(50);
|
|
|
|
|
|
|
|
logger_warn("Nothing to do.");
|
|
|
|
logger_fail("Halt.");
|
|
|
|
}
|
|
|
|
|
|
|
|
void on_timer()
|
|
|
|
{
|
|
|
|
logger_info("Timer tick.");
|
|
|
|
}
|