Compare commits

...

2 Commits

Author SHA1 Message Date
notsomeidiot123 de0b8cd37a Prevent pre-emption during install_irq_handler 2026-07-04 01:20:24 -04:00
notsomeidiot123 f24debd8fb Prevent preemption during spawn_new_process 2026-07-04 01:15:46 -04:00
2 changed files with 4 additions and 0 deletions

View File

@ -126,8 +126,10 @@ void kernel_panic(char *message, cpu_registers_t *regs){
}
void install_irq_handler(void (*handler)(), uint8_t irqno){
asm("cli");
interrupt_handlers[irqno] = handler;
// printf("called\n");
asm("sti");
}
void *get_irq_handler(uint8_t irqno){
return interrupt_handlers[irqno];

View File

@ -72,6 +72,7 @@ cpu_registers_t *schedule(cpu_registers_t *regs){
}
uint32_t spawn_new_process(cpu_registers_t defaultregs, char **argv, uint32_t argc, void *cr3){
asm("cli");
uint32_t i = current_pid;
while(processes[i].flags.present){
i++;
@ -96,6 +97,7 @@ uint32_t spawn_new_process(cpu_registers_t defaultregs, char **argv, uint32_t ar
new_proc.max_descriptors = DEFAULT_FD_MAX;
processes[i] = new_proc;
add_process_queue(i);
asm("sti");
return i;
}