diff --git a/kernel/boot.S b/kernel/boot.S index 2ce03b75..069078ff 100644 --- a/kernel/boot.S +++ b/kernel/boot.S @@ -41,8 +41,11 @@ stack_top: start: /* Setup our stack */ mov $stack_top, %esp - pushl %esp + /* Make sure our stack is 16-byte aligned */ + and $-16, %esp + + pushl %esp pushl %eax /* Multiboot header magic */ pushl %ebx /* Multiboot header pointer */ diff --git a/kernel/cpu/gdt.c b/kernel/cpu/gdt.c index 1f2dc862..f736f4d8 100644 --- a/kernel/cpu/gdt.c +++ b/kernel/cpu/gdt.c @@ -74,7 +74,7 @@ void gdt_install(void) { } static void write_tss(int32_t num, uint16_t ss0, uint32_t esp0) { - tss_entry_t *tss = &gdt.tss; + tss_entry_t * tss = &gdt.tss; uintptr_t base = (uintptr_t)tss; uintptr_t limit = base + sizeof *tss; diff --git a/kernel/cpu/idt.c b/kernel/cpu/idt.c index 71480d2a..10bc4ee0 100644 --- a/kernel/cpu/idt.c +++ b/kernel/cpu/idt.c @@ -44,7 +44,7 @@ void idt_set_gate(uint8_t num, idt_gate_t base, uint16_t sel, uint8_t flags) { } void idt_install(void) { - idt_pointer_t *idtp = &idt.pointer; + idt_pointer_t * idtp = &idt.pointer; idtp->limit = sizeof idt.entries - 1; idtp->base = (uintptr_t)&ENTRY(0); memset(&ENTRY(0), 0, sizeof idt.entries); diff --git a/kernel/cpu/irq.c b/kernel/cpu/irq.c index 7b9b76a9..19057580 100644 --- a/kernel/cpu/irq.c +++ b/kernel/cpu/irq.c @@ -81,7 +81,7 @@ void int_enable(void) { /* Interrupt Requests */ #define IRQ_CHAIN_SIZE 16 -#define IRQ_CHAIN_DEPTH 4 +#define IRQ_CHAIN_DEPTH 4 static void (*irqs[IRQ_CHAIN_SIZE])(void); static irq_handler_chain_t irq_routines[IRQ_CHAIN_SIZE * IRQ_CHAIN_DEPTH] = { NULL }; diff --git a/kernel/include/pipe.h b/kernel/include/pipe.h index 11015381..9cee78ce 100644 --- a/kernel/include/pipe.h +++ b/kernel/include/pipe.h @@ -14,8 +14,6 @@ typedef struct _pipe_device { size_t read_ptr; size_t size; size_t refcount; - //uint8_t volatile lock_read; - //uint8_t volatile lock_write; volatile int lock_read[2]; volatile int lock_write[2]; list_t * wait_queue_readers; diff --git a/kernel/include/task.h b/kernel/include/task.h index 0e58b937..f10466da 100644 --- a/kernel/include/task.h +++ b/kernel/include/task.h @@ -3,7 +3,6 @@ #include - typedef struct page { unsigned int present:1; unsigned int rw:1; diff --git a/kernel/mem/mem.c b/kernel/mem/mem.c index fdb26b42..0e3a2aa9 100644 --- a/kernel/mem/mem.c +++ b/kernel/mem/mem.c @@ -60,6 +60,7 @@ kmalloc_real( spin_lock(frame_alloc_lock); uint32_t index = first_n_frames((size + 0xFFF) / 0x1000); if (index == 0xFFFFFFFF) { + spin_unlock(frame_alloc_lock); return 0; } for (unsigned int i = 0; i < (size + 0xFFF) / 0x1000; ++i) {