stdio: add vsnprintf and change printf to kprintf
This commit is contained in:
parent
05c528f64c
commit
0395b65ad8
21 changed files with 102 additions and 186 deletions
|
|
@ -19,7 +19,7 @@ static void rsdt_parse(struct rsdt *rsdt)
|
|||
int num_sdt = (rsdt->h.length - sizeof(rsdt->h)) >> 2;
|
||||
|
||||
#ifdef KDEBUG
|
||||
printf(LOG_DEBUG "Number of RSDT entries: %d\n", num_sdt);
|
||||
kprintf(LOG_DEBUG "Number of RSDT entries: %d\n", num_sdt);
|
||||
#endif /* KDEBUG */
|
||||
|
||||
for (int i = 0; i < num_sdt; i++) {
|
||||
|
|
@ -38,7 +38,7 @@ static void rsdt_parse(struct rsdt *rsdt)
|
|||
#ifdef KDEBUG
|
||||
char buf[8] = { 0 };
|
||||
memcpy(buf, h->signature, 4);
|
||||
printf(LOG_DEBUG "RSDT entry: %s %d %x \n", buf, h->revision, h->checksum);
|
||||
kprintf(LOG_DEBUG "RSDT entry: %s %d %x \n", buf, h->revision, h->checksum);
|
||||
#endif /* KDEBUG */
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ void acpi_init()
|
|||
rsdt_parse(rsdt);
|
||||
|
||||
#ifdef KDEBUG
|
||||
printf(LOG_DEBUG "ACPI version: %d\n", rsdp->revision);
|
||||
kprintf(LOG_DEBUG "ACPI version: %d\n", rsdp->revision);
|
||||
#endif /* KDEBUG */
|
||||
printf(LOG_SUCCESS "ACPI initialized\n");
|
||||
kprintf(LOG_SUCCESS "ACPI initialized\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,5 +33,5 @@ void gdt_init()
|
|||
|
||||
gdt_load();
|
||||
|
||||
printf(LOG_SUCCESS "GDT initialized\n");
|
||||
kprintf(LOG_SUCCESS "GDT initialized\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,5 +180,5 @@ void idt_init()
|
|||
__idtr.offset = (uint64_t)__idt;
|
||||
idt_load();
|
||||
|
||||
printf(LOG_SUCCESS "IDT successfully loaded\n");
|
||||
kprintf(LOG_SUCCESS "IDT successfully loaded\n");
|
||||
}
|
||||
|
|
|
|||
27
init/main.c
27
init/main.c
|
|
@ -85,8 +85,8 @@ void kmain(void)
|
|||
kroot_part = kfile->gpt_part_uuid;
|
||||
|
||||
#ifdef KDEBUG
|
||||
printf(LOG_DEBUG "Kernel file: path='%s' cmdline='%s'\n", kpath, kcmdline);
|
||||
printf(LOG_DEBUG "Root partition: disk=%X-%X part=%X-%X\n", kroot_disk.a, kroot_disk.b, kroot_part.a, kroot_part.b);
|
||||
kprintf(LOG_DEBUG "Kernel file: path='%s' cmdline='%s'\n", kpath, kcmdline);
|
||||
kprintf(LOG_DEBUG "Root partition: disk=%X-%X part=%X-%X\n", kroot_disk.a, kroot_disk.b, kroot_part.a, kroot_part.b);
|
||||
#endif /* KDEBUG */
|
||||
|
||||
console_init();
|
||||
|
|
@ -99,33 +99,12 @@ void kmain(void)
|
|||
stack_init(ptr, ptr);
|
||||
}
|
||||
|
||||
#ifdef KDEBUG
|
||||
static void kmalloc_init_test()
|
||||
{
|
||||
/* consistency test */
|
||||
void *a = kmalloc(0x1000, ALLOC_KERN);
|
||||
kfree(a);
|
||||
void *b = kmalloc(0x1000, ALLOC_KERN);
|
||||
if (a != b) {
|
||||
printf(LOG_DEBUG "kmalloc consistency test failed\n");
|
||||
} else {
|
||||
printf(LOG_DEBUG "kmalloc consistency test passed\n");
|
||||
}
|
||||
|
||||
kfree(b);
|
||||
}
|
||||
#endif /* KDEBUG */
|
||||
|
||||
void kmain_post_stack_init()
|
||||
{
|
||||
ahci_init();
|
||||
|
||||
_pic_init();
|
||||
|
||||
#ifdef KDEBUG
|
||||
kmalloc_init_test();
|
||||
#endif /* KDEBUG */
|
||||
|
||||
printf("\n\n# ");
|
||||
kprintf("\n\n# ");
|
||||
yield();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue