Replace some uses of check() with expect()

This commit is contained in:
apio 2022-12-04 12:25:16 +01:00
parent bb92480aa3
commit bed29e71af
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 3 additions and 3 deletions

View File

@ -80,7 +80,7 @@ static void set_base(GDTEntry* entry, u32 base)
static void set_limit(GDTEntry* entry, u32 limit) 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->limit0 = limit & 0xFFFF;
entry->limit1_flags = (entry->limit1_flags & 0xF0) | ((limit >> 16) & 0xF); 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) static void idt_add_handler(short num, void* handler, u8 type_attr)
{ {
check(handler != nullptr); check(handler != nullptr);
check(num < 256); expect(num < 256, "IDT can only hold up to 256 entries");
IDTEntry* entry_for_handler = &idt[num]; IDTEntry* entry_for_handler = &idt[num];
entry_for_handler->selector = 0x08; entry_for_handler->selector = 0x08;
entry_for_handler->type_attr = type_attr; entry_for_handler->type_attr = type_attr;

View File

@ -64,7 +64,7 @@ static bool is_block_free(HeapBlock* block)
static usize space_available(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; return block->full_size - block->req_size;
} }