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

Pass kernel information to "main"

This commit is contained in:
Braiden Vasco 2017-11-04 10:38:28 +00:00
parent 698f41c08f
commit 4aebafd717
3 changed files with 19 additions and 2 deletions

View file

@ -10,7 +10,7 @@ extern char _kernel_virt_base;
static struct KernelMQ_Info kinfo; static struct KernelMQ_Info kinfo;
void init(struct KernelMQ_Multiboot_Info multiboot_info) const struct KernelMQ_Info *init(struct KernelMQ_Multiboot_Info multiboot_info)
{ {
kmemset(&kinfo, 0, sizeof(struct KernelMQ_Info)); kmemset(&kinfo, 0, sizeof(struct KernelMQ_Info));
@ -18,4 +18,6 @@ void init(struct KernelMQ_Multiboot_Info multiboot_info)
kinfo.kernel_phys_base = (unsigned long)&_kernel_phys_base; kinfo.kernel_phys_base = (unsigned long)&_kernel_phys_base;
kinfo.kernel_virt_base = (unsigned long)&_kernel_virt_base; kinfo.kernel_virt_base = (unsigned long)&_kernel_virt_base;
return &kinfo;
} }

View file

@ -4,12 +4,26 @@
#include "paging.h" #include "paging.h"
#include "timer.h" #include "timer.h"
#include <kernelmq/info.h>
#include <kernelmq/stdlib.h>
static struct KernelMQ_Info kinfo;
static void on_timer(); static void on_timer();
void main() void main(const struct KernelMQ_Info *const kinfo_ptr)
{ {
kmemset(&kinfo, 0, sizeof(struct KernelMQ_Info));
console_initialize(); console_initialize();
if (!kinfo_ptr) {
logger_fail("No kernel information. Halt.");
return;
}
kinfo = *kinfo_ptr;
protected_initialize(); protected_initialize();
// paging_initialize(); // paging_initialize();

View file

@ -35,6 +35,7 @@ _start:
mov $stack_top, %esp // Initialize stack mov $stack_top, %esp // Initialize stack
push %eax // Kernel information pointer
call main call main
halt: halt: