forked from PoliEcho-holding-org/kern
Added __printf() attributes to printf-like functions
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
#include <isr.h>
|
||||
#include <pmm.h>
|
||||
|
||||
void a(void) { *(char*)(1234) = 0; }
|
||||
|
||||
__noreturn
|
||||
void _start(void) {
|
||||
int err = 0;
|
||||
@@ -37,8 +35,6 @@ void _start(void) {
|
||||
// The most important function in the world.
|
||||
splash();
|
||||
|
||||
a();
|
||||
|
||||
// Patiently wait for things to do :)
|
||||
while (1);
|
||||
};
|
||||
|
||||
+2
-4
@@ -11,8 +11,6 @@
|
||||
// VIRTUAL address of the kernels PML4
|
||||
uint64_t* pag_kernel_pml4 = NULL;
|
||||
|
||||
// abcabcaaabcaab
|
||||
|
||||
int pag_init(void) {
|
||||
pag_kernel_pml4 = TO_VIRT(pmm_alloc());
|
||||
if (IS_ERR(pag_kernel_pml4)) return PTR_ERR(pag_kernel_pml4);
|
||||
@@ -43,8 +41,8 @@ int pag_init(void) {
|
||||
case LIMINE_MEMMAP_RESERVED_MAPPED: flags = 0; break;
|
||||
default:
|
||||
pr_warning(
|
||||
"[pag] %p - %p: Unknown memmap type %d. Will remain unmapped.\n",
|
||||
entry->base, entry->base + entry->length, entry->type
|
||||
"[pag] %p - %p: Unknown memmap type %lu. Will remain unmapped.\n",
|
||||
(void*)entry->base, (void*)entry->base + entry->length, entry->type
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ void panic_call_trace(void) {
|
||||
// TODO: Parse ELF and print function names
|
||||
char* fname = "???";
|
||||
|
||||
pr_emerg(" [<%p>] %s+0x%x\n", retaddr, fname, offset);
|
||||
pr_emerg(" [<%p>] %s+0x%lx\n", (void*)retaddr, fname, offset);
|
||||
|
||||
rbp = (uintptr_t*)*rbp;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ void vpanic(const char *fmt, va_list ap) {
|
||||
|
||||
pr_emerg("--- [ Kernel panic: %s ] ---\n\n", buf);
|
||||
|
||||
pr_emerg("%d / %d pages free.\n\n", pmm_free_pages, pmm_total_pages);
|
||||
pr_emerg("%lu / %lu pages free.\n\n", pmm_free_pages, pmm_total_pages);
|
||||
panic_call_trace();
|
||||
|
||||
pr_emerg("\n--- [ End kernel panic: %s ] ---\n", buf);
|
||||
|
||||
+4
-4
@@ -16,8 +16,8 @@ int pmm_init(void) {
|
||||
struct limine_memmap_entry* entry = bootloader.mm_entries[i];
|
||||
|
||||
pr_info(
|
||||
"\t%p - %p (%d bytes), type %d\n",
|
||||
entry->base, entry->base + entry->length, entry->length, entry->type
|
||||
"\t%p - %p (%lu bytes), type %lu\n",
|
||||
(void*)entry->base, (void*)entry->base + entry->length, entry->length, entry->type
|
||||
);
|
||||
|
||||
if (entry->type != LIMINE_MEMMAP_USABLE) continue;
|
||||
@@ -25,7 +25,7 @@ int pmm_init(void) {
|
||||
// Limine spec says that it'll be aligned, but just as a sanity check
|
||||
if (entry->base % PAGE_SIZE != 0) {
|
||||
size_t diff = PAGE_SIZE - (entry->base % PAGE_SIZE);
|
||||
pr_info("\t Not 4 kiB aligned, shifting %p -> %p (%d bytes).\n", entry->base, entry->base + diff, diff);
|
||||
pr_info("\t Not 4 kiB aligned, shifting %p -> %p (%lu bytes).\n", (void*)entry->base, (void*)entry->base + diff, diff);
|
||||
entry->base += diff;
|
||||
entry->length -= diff;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ int pmm_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
pr_info("[pmm] %d free pages.\n", pmm_total_pages);
|
||||
pr_info("[pmm] %lu free pages.\n", pmm_total_pages);
|
||||
if (pmm_total_pages == 0) return -ENOMEM;
|
||||
pmm_free_pages = pmm_total_pages;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user