Initial commit - slab allocator, kmalloc, other re
factors
This commit is contained in:
parent
1dd7b8b07f
commit
4e40a040dd
39 changed files with 863 additions and 412 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#include "idt.h"
|
||||
#include "error.h"
|
||||
#include "timer.h"
|
||||
#include <stdio.h>
|
||||
#include <kprint.h>
|
||||
#include <lock.h>
|
||||
#include <SFB25.h>
|
||||
idt_descriptor idt[256] = {0};
|
||||
|
|
@ -60,10 +60,10 @@ atomic_flag irq_register_lock = ATOMIC_FLAG_INIT;
|
|||
|
||||
/* Registers an IRQ with the specified vector. */
|
||||
kstatus register_irq_vector(uint8_t vector, void *base, uint8_t flags){
|
||||
acquire_lock(&irq_register_lock);
|
||||
acquire_spinlock(&irq_register_lock);
|
||||
|
||||
if(!irq_list[vector].in_use){
|
||||
free_lock(&irq_register_lock);
|
||||
free_spinlock(&irq_register_lock);
|
||||
return KERNEL_STATUS_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -74,27 +74,27 @@ kstatus register_irq_vector(uint8_t vector, void *base, uint8_t flags){
|
|||
|
||||
s_load_idt();
|
||||
|
||||
free_lock(&irq_register_lock);
|
||||
free_spinlock(&irq_register_lock);
|
||||
|
||||
return KERNEL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Registers an IRQ and returns the vector */
|
||||
int register_irq(void *base, uint8_t flags){
|
||||
acquire_lock(&irq_register_lock);
|
||||
acquire_spinlock(&irq_register_lock);
|
||||
|
||||
for(size_t i = 0; i < MAX_IRQ; i++){
|
||||
if(!irq_list[i].in_use) {
|
||||
set_idt_descriptor(i, base, flags);
|
||||
irq_list[i].base = base;
|
||||
irq_list[i].in_use = true;
|
||||
free_lock(&irq_register_lock);
|
||||
free_spinlock(&irq_register_lock);
|
||||
s_load_idt();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
free_lock(&irq_register_lock);
|
||||
free_spinlock(&irq_register_lock);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue