1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-10-30 12:03:52 -04:00
kernel/arch/init.c

40 lines
928 B
C
Raw Normal View History

2017-11-03 22:39:16 -04:00
#include "console.h"
2017-11-03 23:31:13 -04:00
#include "logger.h"
2017-11-04 06:19:53 -04:00
#include "kprintf.h"
2017-11-03 23:31:13 -04:00
#include "multiboot.h"
2017-11-03 01:10:07 -04:00
2017-11-04 06:09:53 -04:00
#include <kernelmq/info.h>
2017-11-04 06:19:53 -04:00
#include <kernelmq/stdlib.h>
// Defined in linker script
extern char _kernel_offset;
extern char _kernel_phys_base;
extern char _kernel_virt_base;
2017-11-04 06:09:53 -04:00
static struct KernelMQ_Info kinfo;
2017-11-03 22:15:05 -04:00
void init(struct KernelMQ_Multiboot_Info multiboot_info)
2017-11-01 00:43:42 -04:00
{
2017-11-04 06:19:53 -04:00
kmemset(&kinfo, 0, sizeof(struct KernelMQ_Info));
kinfo.kernel_offset = (unsigned long)&_kernel_offset;
kinfo.kernel_phys_base = (unsigned long)&_kernel_phys_base;
kinfo.kernel_virt_base = (unsigned long)&_kernel_virt_base;
2017-11-03 22:39:16 -04:00
console_initialize();
2017-11-01 04:25:39 -04:00
2017-11-03 23:31:13 -04:00
logger_info("Multiboot info:");
2017-11-01 10:45:01 -04:00
print_multiboot_info(multiboot_info);
2017-11-04 00:02:01 -04:00
logger_info("Virtual memory info:");
2017-11-04 06:19:53 -04:00
kprintf(
"0x%x (phys base) + 0x%x (offset) = 0x%x (virt base)\n",
kinfo.kernel_phys_base,
kinfo.kernel_offset,
kinfo.kernel_virt_base
);
2017-11-03 01:10:07 -04:00
}