remove newlines in assert

This commit is contained in:
2026-10-13 23:01:41 +02:00
parent 2a3bc68ba7
commit 56d43a94a9
8 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ void lapic_init(struct local_apic* lapic) {
uintptr_t vaddr = vm_alloc(0x1000); uintptr_t vaddr = vm_alloc(0x1000);
pmap_map(&kernel_vma.pmap, vaddr, apic_msr & 0xFFFF'F000, PTE_READ | PTE_WRITE, CACHE_MMIO); pmap_map(&kernel_vma.pmap, vaddr, apic_msr & 0xFFFF'F000, PTE_READ | PTE_WRITE, CACHE_MMIO);
lapic->xapic_regs = (void*)vaddr; lapic->xapic_regs = (void*)vaddr;
assert(lapic->xapic_regs, "Failed to allocate virtual memory!\n"); assert(lapic->xapic_regs, "Failed to allocate virtual memory!");
} }
asm_wrmsr(0x1B, apic_msr); asm_wrmsr(0x1B, apic_msr);
+1 -1
View File
@@ -74,7 +74,7 @@ static void hpet_init(struct boot_info*) {
uint64_t caps = mmio_read64(hpet_clock.regs + HPET_CAP); uint64_t caps = mmio_read64(hpet_clock.regs + HPET_CAP);
hpet_clock.period = (caps >> 32) & 0xFFFF'FFFF; hpet_clock.period = (caps >> 32) & 0xFFFF'FFFF;
assert(clock_switch(&hpet_clock.clock), "Unable to switch to HPET!\n"); assert(clock_switch(&hpet_clock.clock), "Unable to switch to HPET!");
} }
INIT_TASK(hpet_stage, "arch.x86_64.hpet", hpet_init); INIT_TASK(hpet_stage, "arch.x86_64.hpet", hpet_init);
INIT_DEPENDS(hpet_stage, acpi_stage); INIT_DEPENDS(hpet_stage, acpi_stage);
+2 -2
View File
@@ -96,9 +96,9 @@ void interrupt_handler(struct arch_context* ctx) {
default: default:
if (isr < 0x20) if (isr < 0x20)
panic("Unhandled exception %lu at %#lx, error: %#lx\n", isr, ctx->rip, ctx->error); panic("Unhandled exception %lu at %#lx, error: %#lx\n", isr, ctx->rip, ctx->error);
assert(isr - 0x20 < ARRAY_SIZE(arch_cpu->irq_lines), "Unhandled interrupt on ISR %lu\n", isr); assert(isr - 0x20 < ARRAY_SIZE(arch_cpu->irq_lines), "Unhandled interrupt on ISR %lu", isr);
struct irq_line* line = arch_cpu->irq_lines[isr - 0x20]; struct irq_line* line = arch_cpu->irq_lines[isr - 0x20];
assert(line, "Unhandled interrupt on ISR %lu\n", isr); assert(line, "Unhandled interrupt on ISR %lu", isr);
irq_line_raise(line); irq_line_raise(line);
} }
} }
+1 -1
View File
@@ -114,7 +114,7 @@ errno_t arch_task_init(
) { ) {
struct arch_percpu* cpu = percpu_ref(arch_data); struct arch_percpu* cpu = percpu_ref(arch_data);
assert((stack_start & 0xF) == 0, "Task stack is not 16-byte aligned!\n"); assert((stack_start & 0xF) == 0, "Task stack is not 16-byte aligned!");
// Prepare a dummy stack with an entry point function to return to. // Prepare a dummy stack with an entry point function to return to.
struct task_frame* frame = (struct task_frame*)(stack_start - sizeof(uint64_t)) - 1; struct task_frame* frame = (struct task_frame*)(stack_start - sizeof(uint64_t)) - 1;
+1 -1
View File
@@ -275,7 +275,7 @@ static errno_t build_temp_table(phys_t* out) {
void x86_64_smp_init() { void x86_64_smp_init() {
const size_t trampoline_size = smp_trampoline_end - smp_trampoline_start; const size_t trampoline_size = smp_trampoline_end - smp_trampoline_start;
assert(trampoline_size <= arch_mem_page_size(), "SMP trampoline doesn't fit in a page\n"); assert(trampoline_size <= arch_mem_page_size(), "SMP trampoline doesn't fit in a page");
const size_t max_cpus = percpu_max_cpus(); const size_t max_cpus = percpu_max_cpus();
if (max_cpus <= 1) if (max_cpus <= 1)
+6 -6
View File
@@ -66,7 +66,7 @@ void mem_init(struct phys_mem* map, size_t map_len, uintptr_t kernel_virt, phys_
// since we're likely going to map it at a different base address. // since we're likely going to map it at a different base address.
mem_hhdm_base = tmp_hhdm; mem_hhdm_base = tmp_hhdm;
assert(pmap_new_kernel(&kernel_vma.pmap, 0) == 0, "Unable to allocate the kernel page table\n"); assert(pmap_new_kernel(&kernel_vma.pmap, 0) == 0, "Unable to allocate the kernel page table");
tailq_init(&kernel_vma.mappings); tailq_init(&kernel_vma.mappings);
// text // text
@@ -79,7 +79,7 @@ void mem_init(struct phys_mem* map, size_t map_len, uintptr_t kernel_virt, phys_
PTE_READ | PTE_EXEC, PTE_READ | PTE_EXEC,
CACHE_ANY CACHE_ANY
); );
assert(!status, "Failed to map %p with error %i\n", p, status); assert(!status, "Failed to map %p with error %i", p, status);
} }
// rodata // rodata
@@ -92,7 +92,7 @@ void mem_init(struct phys_mem* map, size_t map_len, uintptr_t kernel_virt, phys_
PTE_READ, PTE_READ,
CACHE_ANY CACHE_ANY
); );
assert(!status, "Failed to map %p with error %i\n", p, status); assert(!status, "Failed to map %p with error %i", p, status);
} }
// data // data
@@ -105,7 +105,7 @@ void mem_init(struct phys_mem* map, size_t map_len, uintptr_t kernel_virt, phys_
PTE_READ | PTE_WRITE, PTE_READ | PTE_WRITE,
CACHE_ANY CACHE_ANY
); );
assert(!status, "Failed to map %p with error %i\n", p, status); assert(!status, "Failed to map %p with error %i", p, status);
} }
// The kernel address space is divided into 4 segments. // The kernel address space is divided into 4 segments.
@@ -124,7 +124,7 @@ void mem_init(struct phys_mem* map, size_t map_len, uintptr_t kernel_virt, phys_
uintptr_t vaddr = (uintptr_t)(map[i].address + p + tmp_hhdm); uintptr_t vaddr = (uintptr_t)(map[i].address + p + tmp_hhdm);
phys_t paddr = (phys_t)(map[i].address + p); phys_t paddr = (phys_t)(map[i].address + p);
errno_t status = pmap_map(&kernel_vma.pmap, vaddr, paddr, PTE_READ | PTE_WRITE, CACHE_ANY); errno_t status = pmap_map(&kernel_vma.pmap, vaddr, paddr, PTE_READ | PTE_WRITE, CACHE_ANY);
assert(!status, "Failed to map HHDM page %p to %p with error %i\n", (void*)vaddr, (void*)paddr, status); assert(!status, "Failed to map HHDM page %p to %p with error %i", (void*)vaddr, (void*)paddr, status);
} }
} }
mem_hhdm_base = tmp_hhdm; mem_hhdm_base = tmp_hhdm;
@@ -152,7 +152,7 @@ void mem_init(struct phys_mem* map, size_t map_len, uintptr_t kernel_virt, phys_
for (size_t page = 0; page < length; page += pgsz) { for (size_t page = 0; page < length; page += pgsz) {
phys_t paddr; phys_t paddr;
assert(!mem_phys_alloc(1, 0, &paddr), "Failed to allocate memory for PFNDB!\n"); assert(!mem_phys_alloc(1, 0, &paddr), "Failed to allocate memory for PFNDB!");
assert( assert(
!pmap_map(&kernel_vma.pmap, vaddr + page, paddr, PTE_READ | PTE_WRITE, CACHE_ANY), !pmap_map(&kernel_vma.pmap, vaddr + page, paddr, PTE_READ | PTE_WRITE, CACHE_ANY),
"Failed to map PFNDB memory" "Failed to map PFNDB memory"
+1 -1
View File
@@ -112,7 +112,7 @@ bool vma_page_fault(struct vma* v, const struct vma_fault_info* info) {
if (still_valid) { if (still_valid) {
errno_t status = errno_t status =
pmap_map(&v->pmap, faulty_page * page_size, vm_page_addr(page), prot_to_pte(v, prot), CACHE_ANY); pmap_map(&v->pmap, faulty_page * page_size, vm_page_addr(page), prot_to_pte(v, prot), CACHE_ANY);
assert(status == 0, "Failed to map a demand-loaded page\n"); assert(status == 0, "Failed to map a demand-loaded page");
} }
spin_unlock(&v->lock); spin_unlock(&v->lock);
+3 -3
View File
@@ -37,11 +37,11 @@ void sched_to_user_context(uintptr_t ctx) {
void sched_init(struct scheduler* sched) { void sched_init(struct scheduler* sched) {
struct task* idle_task; struct task* idle_task;
assert(task_create("idle", &kernel_vma, idle_func, 0, &idle_task) == 0, "Unable to create idle task!\n"); assert(task_create("idle", &kernel_vma, idle_func, 0, &idle_task) == 0, "Unable to create idle task!");
sched->idle_task = idle_task; sched->idle_task = idle_task;
struct task* boot_task = mem_alloc(sizeof(struct task), 0); struct task* boot_task = mem_alloc(sizeof(struct task), 0);
assert(boot_task != nullptr, "Unable to create boot task!\n"); assert(boot_task != nullptr, "Unable to create boot task!");
strncpy(boot_task->name, "boot", sizeof(boot_task->name)); strncpy(boot_task->name, "boot", sizeof(boot_task->name));
boot_task->space = &kernel_vma; boot_task->space = &kernel_vma;
sched->current = boot_task; sched->current = boot_task;
@@ -52,7 +52,7 @@ void sched_init(struct scheduler* sched) {
} }
void sched_add_task(struct scheduler* sched, struct task* task) { void sched_add_task(struct scheduler* sched, struct task* task) {
assert(task != nullptr, "Tried to add NULL to the run queue\n"); assert(task != nullptr, "Tried to add NULL to the run queue");
task->state = TASK_STATE_READY; task->state = TASK_STATE_READY;
tailq_insert_tail(&sched->run_queue, task, next); tailq_insert_tail(&sched->run_queue, task, next);
} }