Align stack pointer on kernel proper entry to 16-byte. Eliminate dead-lock in frame allocator on OOM. Formatting.
This commit is contained in:
parent
a699c91ddd
commit
e27cb1b96f
@ -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 */
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 };
|
||||
|
@ -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;
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
|
||||
typedef struct page {
|
||||
unsigned int present:1;
|
||||
unsigned int rw:1;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user