From bed29e71af0464f12c641bbc16ba7b83c4aa536d Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 4 Dec 2022 12:25:16 +0100 Subject: [PATCH] Replace some uses of check() with expect() --- kernel/src/arch/x86_64/CPU.cpp | 4 ++-- kernel/src/memory/Heap.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/src/arch/x86_64/CPU.cpp b/kernel/src/arch/x86_64/CPU.cpp index a4cbb6c2..d5a7ee3d 100644 --- a/kernel/src/arch/x86_64/CPU.cpp +++ b/kernel/src/arch/x86_64/CPU.cpp @@ -80,7 +80,7 @@ static void set_base(GDTEntry* entry, u32 base) static void set_limit(GDTEntry* entry, u32 limit) { - check(limit <= 0xFFFFF); + expect(limit <= 0xFFFFF, "Limit too big for a GDT entry"); entry->limit0 = limit & 0xFFFF; entry->limit1_flags = (entry->limit1_flags & 0xF0) | ((limit >> 16) & 0xF); } @@ -208,7 +208,7 @@ struct IDTR static void idt_add_handler(short num, void* handler, u8 type_attr) { check(handler != nullptr); - check(num < 256); + expect(num < 256, "IDT can only hold up to 256 entries"); IDTEntry* entry_for_handler = &idt[num]; entry_for_handler->selector = 0x08; entry_for_handler->type_attr = type_attr; diff --git a/kernel/src/memory/Heap.cpp b/kernel/src/memory/Heap.cpp index 54dbb9f0..d98a205d 100644 --- a/kernel/src/memory/Heap.cpp +++ b/kernel/src/memory/Heap.cpp @@ -64,7 +64,7 @@ static bool is_block_free(HeapBlock* block) static usize space_available(HeapBlock* block) { - check(!is_block_free(block)); + expect(!is_block_free(block), "Attempting to split a free block"); return block->full_size - block->req_size; }