forked from PoliEcho-holding-org/kern
Write vsnprintf() implementation
This commit is contained in:
+9
-22
@@ -1,4 +1,4 @@
|
||||
#include <multiboot.h>
|
||||
#include <bootloader.h>
|
||||
#include <kernel.h>
|
||||
#include <serial.h>
|
||||
#include <pmm.h>
|
||||
@@ -6,43 +6,30 @@
|
||||
|
||||
#define _hlt() while (1) __asm__ volatile ("cli; hlt");
|
||||
|
||||
char* itoa(uint8_t n) {
|
||||
static char str[32];
|
||||
int i = sizeof(str) - 2;
|
||||
while (n) {
|
||||
str[i--] = (n % 10) + '0';
|
||||
n /= 10;
|
||||
}
|
||||
str[sizeof(str) - 1] = '\0';
|
||||
return &str[i+1];
|
||||
}
|
||||
|
||||
__noreturn
|
||||
void kmain(void* ptr) {
|
||||
multiboot_info_t* mbi = ptr;
|
||||
void kmain(void* ptr, uint32_t magic) {
|
||||
// Init with MultiBoot 1, this populates the global bootloader struct
|
||||
//if (boot_init(BOOT_MB1, ptr, magic) != 0) panic("Unsupporred bootloader.");
|
||||
|
||||
// Serial console for debugging
|
||||
serial_init(COM1);
|
||||
serial_puts(COM1, "\x1b[0H\x1b[Jkern.\n");
|
||||
|
||||
// Check if we have a valid memmap
|
||||
if (!(mbi->flags >> 6 & 1)) {
|
||||
panic("Invalid memory map.");
|
||||
}
|
||||
|
||||
// VGA tty thingy
|
||||
tty_init();
|
||||
tty_puts("kern.");
|
||||
tty_puts("kern.\n\n");
|
||||
|
||||
// Memory manager init
|
||||
// pmm_init();
|
||||
// vmm_init();
|
||||
|
||||
// x86 shit
|
||||
// gdt_init();
|
||||
// isr_init();
|
||||
// pag_init();
|
||||
|
||||
debugf("Basic initialization complete!\n");
|
||||
|
||||
/* TODO: Commeted out stuff */
|
||||
/* TODO: Commented out stuff */
|
||||
|
||||
panic("kmain() reached end.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user