mirror of
https://github.com/tailix/kernel.git
synced 2024-11-20 11:16:10 -05:00
Pass kernel information to "main"
This commit is contained in:
parent
698f41c08f
commit
4aebafd717
3 changed files with 19 additions and 2 deletions
|
@ -10,7 +10,7 @@ extern char _kernel_virt_base;
|
|||
|
||||
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));
|
||||
|
||||
|
@ -18,4 +18,6 @@ void init(struct KernelMQ_Multiboot_Info multiboot_info)
|
|||
|
||||
kinfo.kernel_phys_base = (unsigned long)&_kernel_phys_base;
|
||||
kinfo.kernel_virt_base = (unsigned long)&_kernel_virt_base;
|
||||
|
||||
return &kinfo;
|
||||
}
|
||||
|
|
16
arch/main.c
16
arch/main.c
|
@ -4,12 +4,26 @@
|
|||
#include "paging.h"
|
||||
#include "timer.h"
|
||||
|
||||
#include <kernelmq/info.h>
|
||||
#include <kernelmq/stdlib.h>
|
||||
|
||||
static struct KernelMQ_Info kinfo;
|
||||
|
||||
static void on_timer();
|
||||
|
||||
void main()
|
||||
void main(const struct KernelMQ_Info *const kinfo_ptr)
|
||||
{
|
||||
kmemset(&kinfo, 0, sizeof(struct KernelMQ_Info));
|
||||
|
||||
console_initialize();
|
||||
|
||||
if (!kinfo_ptr) {
|
||||
logger_fail("No kernel information. Halt.");
|
||||
return;
|
||||
}
|
||||
|
||||
kinfo = *kinfo_ptr;
|
||||
|
||||
protected_initialize();
|
||||
|
||||
// paging_initialize();
|
||||
|
|
|
@ -35,6 +35,7 @@ _start:
|
|||
|
||||
mov $stack_top, %esp // Initialize stack
|
||||
|
||||
push %eax // Kernel information pointer
|
||||
call main
|
||||
|
||||
halt:
|
||||
|
|
Loading…
Reference in a new issue