mirror of https://github.com/tailix/kernel.git
Add function "main"
This commit is contained in:
parent
29fd24c72e
commit
0dc6119576
|
@ -5,6 +5,7 @@ CC = $(CCPREFIX)gcc
|
|||
|
||||
OBJS = start.s.o
|
||||
OBJS += init.c.o
|
||||
OBJS += main.c.o
|
||||
|
||||
OBJS += logger.c.o console.c.o
|
||||
OBJS += multiboot.c.o
|
||||
|
|
19
arch/init.c
19
arch/init.c
|
@ -1,28 +1,9 @@
|
|||
#include "multiboot.h"
|
||||
#include "logger.h"
|
||||
#include "protected.h"
|
||||
#include "timer.h"
|
||||
|
||||
static void on_timer();
|
||||
|
||||
void init(struct KernelMQ_Multiboot_Info multiboot_info)
|
||||
{
|
||||
logger_initialize();
|
||||
|
||||
print_multiboot_info(multiboot_info);
|
||||
|
||||
logger_info("Kernel initialization started.");
|
||||
|
||||
protected_initialize();
|
||||
|
||||
timer_register_handler(on_timer);
|
||||
timer_initialize(50);
|
||||
|
||||
logger_warn("Nothing to do.");
|
||||
logger_fail("Halt.");
|
||||
}
|
||||
|
||||
void on_timer()
|
||||
{
|
||||
logger_info("Timer tick.");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#include "logger.h"
|
||||
#include "protected.h"
|
||||
#include "timer.h"
|
||||
|
||||
static void on_timer();
|
||||
|
||||
void main()
|
||||
{
|
||||
logger_info("Kernel initialization started.");
|
||||
|
||||
protected_initialize();
|
||||
|
||||
timer_register_handler(on_timer);
|
||||
timer_initialize(50);
|
||||
|
||||
logger_warn("Nothing to do.");
|
||||
logger_fail("Halt.");
|
||||
}
|
||||
|
||||
void on_timer()
|
||||
{
|
||||
logger_info("Timer tick.");
|
||||
}
|
|
@ -28,6 +28,11 @@ _start:
|
|||
push %ebx // Multiboot information pointer
|
||||
push %eax // Multiboot magic number
|
||||
call init
|
||||
|
||||
mov $stack_top, %esp // Initialize stack
|
||||
|
||||
call main
|
||||
|
||||
cli
|
||||
1:
|
||||
hlt
|
||||
|
|
Loading…
Reference in New Issue