panic: add panic function

also remove print messages from APIC driver
This commit is contained in:
Michael Shaw 2023-10-27 22:34:10 -04:00
commit 1cf54c7fd3
4 changed files with 10 additions and 3 deletions

View file

@ -32,7 +32,6 @@ void ioapic_redirect_insert(size_t irq, size_t isr, size_t low_active, size_t le
{
/* Set the interrupt redirection entry */
ioapic_write(0x10 + 2 * irq, (level_trigger << 15) | (low_active << 13) | isr);
kprintf("lapic_id: %d\n", lapic_id);
ioapic_write(0x10 + 2 * irq + 1, lapic_id << 24);
}
@ -106,7 +105,6 @@ void apic_init()
/* get ioapic version */
lapic_id = lapic_read(lapic_addr, 0x20);
kprintf(LOG_WARN "lapic_id: %d\n", lapic_id);
ioapic_redirect_insert(4, 0x24, 0, 0);
/* Set spurious interrupt vector to 0xFF and enable the LAPIC */

View file

@ -273,7 +273,7 @@ void vfs_init(const char *rootdev_name)
struct block_device *rootdev = block_get_device(rootdev_name);
if (!rootdev) {
kprintf(LOG_ERROR "Failed to find root device %s\n", rootdev_name);
return;
panic();
}
kprintf(LOG_DEBUG "Found root device %s\n", rootdev_name);
@ -286,6 +286,7 @@ void vfs_init(const char *rootdev_name)
return;
} else {
kprintf(LOG_DEBUG "Mounted root device %s\n", rootdev_name);
panic();
}
fs->mount_point = kzalloc(2, ALLOC_KERN);

View file

@ -23,6 +23,7 @@
#define GB (KB * MB)
void yield();
void panic();
typedef uintptr_t paddr_t;
typedef uint32_t paddr32_t;

View file

@ -46,6 +46,13 @@ void yield()
}
}
void panic()
{
kprintf(LOG_ERROR "KERNEL PANIC\n");
cli();
yield();
}
static inline void _pic_init()
{
cli();