bond/arch/init.c

72 lines
1.6 KiB
C
Raw Normal View History

2019-06-26 05:47:18 +00:00
#include <kern/cdef.h>
2019-11-28 18:02:52 +00:00
#include <kern/print.h>
2018-12-16 23:52:33 +00:00
#include <arch/print.h>
2019-11-28 18:02:52 +00:00
#include <arch/brute.h>
2018-10-01 17:01:00 +00:00
2018-12-16 23:52:33 +00:00
// private headers
#include "multiboot2.h"
2019-11-28 18:02:52 +00:00
void arch_main(ATTR_UNUSED void* mb_info)
2015-04-21 00:19:06 +00:00
{
2019-11-28 18:02:52 +00:00
/* init printf related stuff */
2018-12-16 23:52:33 +00:00
arch_print_init();
2019-06-26 05:47:18 +00:00
2019-11-28 18:02:52 +00:00
kprintf("Initializing arch layer...\n");
arch_brute();
2018-12-16 23:52:33 +00:00
2019-11-28 18:02:52 +00:00
/* if (mb_info == NULL)
2018-10-01 17:01:00 +00:00
{
goto err;
2018-10-01 17:01:00 +00:00
}
2016-06-05 23:37:29 +00:00
char *cur_ptr = (char *) mb_info + 8;
char *bootloader_name = NULL;
while (1)
{
struct multiboot_tag *cur_tag = (struct multiboot_tag *) cur_ptr;
switch (cur_tag->type)
{
case MULTIBOOT_TAG_TYPE_MMAP:
hal_mem_init((struct multiboot_tag_mmap*) cur_ptr);
break;
case MULTIBOOT_TAG_TYPE_FRAMEBUFFER:
hal_print_init((struct multiboot_tag_framebuffer *) cur_ptr);
break;
case MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME:
bootloader_name = ((struct multiboot_tag_string*)cur_ptr)->string;
break;
case MULTIBOOT_TAG_TYPE_ACPI_NEW:
default:
break;
}
if (cur_tag->type == MULTIBOOT_TAG_TYPE_END)
{
break;
}
cur_ptr += cur_tag->size;
cur_ptr = (char *) ALIGN(uintptr, cur_ptr, 8);
}
hal_halt_cpu();
2016-06-05 23:37:29 +00:00
hal_printf("Boot loader:%d\n", bootloader_name);
2018-10-01 17:01:00 +00:00
struct boot_info *boot_info = halloc(sizeof(struct boot_info));
2018-10-01 17:01:00 +00:00
// // obtain cpu info
// halp_obtain_cpu_info(boot_info);
2018-10-01 17:01:00 +00:00
// init interrupt
if (hal_interrupt_init() != 0)
{
hal_halt_cpu();
}
2018-10-02 06:43:30 +00:00
kmain(boot_info);
err:
2019-06-26 05:47:18 +00:00
hal_halt_cpu(); */
}