Cleanup
This commit is contained in:
parent
fee6738226
commit
5d790cadbb
@ -1,4 +1,5 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <cpu.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <vga.h>
|
#include <vga.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
@ -23,11 +24,11 @@ void kmain(uint64_t multiboot_magic, void *multiboot_data)
|
|||||||
|
|
||||||
debug("Started kernel\n");
|
debug("Started kernel\n");
|
||||||
|
|
||||||
debug("Multiboot magic: %x", multiboot_magic);
|
cpu_init();
|
||||||
|
|
||||||
multiboot_init(multiboot_magic, P2V(multiboot_data));
|
multiboot_init(multiboot_magic, P2V(multiboot_data));
|
||||||
|
|
||||||
debug_info("Multiboot v %d kernel loaded.\n", kernel_boot_data.multiboot_version);
|
debug_info("Kernel loaded with command line: \"%s\" by <%s>\n", kernel_boot_data.commandline, kernel_boot_data.bootloader);
|
||||||
debug_info("Bootloader: %s\n", kernel_boot_data.bootloader);
|
|
||||||
|
|
||||||
debug_info("Memory areas:\n");
|
debug_info("Memory areas:\n");
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
@ -37,9 +38,6 @@ void kmain(uint64_t multiboot_magic, void *multiboot_data)
|
|||||||
{
|
{
|
||||||
debug_info("%d %x-%x\n", type, start, end);
|
debug_info("%d %x-%x\n", type, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
interrupt_init();
|
|
||||||
|
|
||||||
bind_interrupt(0, divbyzero);
|
bind_interrupt(0, divbyzero);
|
||||||
|
|
||||||
debug("Hello, world!");
|
debug("Hello, world!");
|
||||||
@ -47,6 +45,8 @@ void kmain(uint64_t multiboot_magic, void *multiboot_data)
|
|||||||
// Force a divide by zero error
|
// Force a divide by zero error
|
||||||
divide(5, 0);
|
divide(5, 0);
|
||||||
|
|
||||||
|
debug_info("Boot complete\n");
|
||||||
|
|
||||||
PANIC("End of kernel function!");
|
PANIC("End of kernel function!");
|
||||||
|
|
||||||
debug_info("Broke out of panic");
|
debug_info("Broke out of panic");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
// https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html
|
// https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html
|
||||||
|
|
||||||
@ -47,7 +46,6 @@ int parse_multiboot2(struct taglist *tags)
|
|||||||
struct tag *tag = incptr(tags, sizeof(struct taglist));
|
struct tag *tag = incptr(tags, sizeof(struct taglist));
|
||||||
while(tag->type)
|
while(tag->type)
|
||||||
{
|
{
|
||||||
debug("Tag type: %d\n", tag->type);
|
|
||||||
switch(tag->type)
|
switch(tag->type)
|
||||||
{
|
{
|
||||||
case MBOOT2_TAG_BOOTLOADER:
|
case MBOOT2_TAG_BOOTLOADER:
|
||||||
|
6
src/kernel/cpu/cpu.c
Normal file
6
src/kernel/cpu/cpu.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <interrupts.h>
|
||||||
|
|
||||||
|
void cpu_init()
|
||||||
|
{
|
||||||
|
interrupt_init();
|
||||||
|
}
|
@ -1,3 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// cpu/cpu.c
|
||||||
|
void cpu_init();
|
||||||
|
|
||||||
|
// cpu/registers.S
|
||||||
void load_idt(void *);
|
void load_idt(void *);
|
Loading…
x
Reference in New Issue
Block a user