Task contexts now load segment registers correctly

Interrupt enable bit set in saved EFLAGS register
This commit is contained in:
2021-04-18 02:10:03 -05:00
parent 1171aa2ca3
commit c39cbb79cd
3 changed files with 32 additions and 7 deletions

View File

@@ -16,6 +16,12 @@ void isr_division_by_zero(void* frame)
void isr_gp_fault(void* frame, unsigned int error)
{
asm("cli");
asm("mov $0x10, %%ax; "
"mov %%ax, %%ds; "
"mov %%ax, %%es; "
"mov %%ax, %%fs; "
"mov %%ax, %%gs; "
::: "ax");
printf("Exception: GP fault, code %08x\n", error);
asm("hlt");
}
@@ -25,6 +31,12 @@ void isr_page_fault(void* frame, unsigned int error)
size_t addr;
asm("mov %%cr2, %0"
: "=r"(addr));
asm("mov $0x10, %%ax; "
"mov %%ax, %%ds; "
"mov %%ax, %%es; "
"mov %%ax, %%fs; "
"mov %%ax, %%gs; "
::: "ax");
printf("Exception: Page fault, code %08x, linear address %08x\n", error, addr);
asm("hlt");
}
@@ -45,11 +57,19 @@ void isr_timer(void* frame)
void isr_preempt(void* frame)
{
asm("pushal;"
"mov %esp, %ebp");
asm("pushal; "
"mov %esp, %ebp; ");
asm("mov $0x10, %%ax; "
"mov %%ax, %%ds; "
"mov %%ax, %%es; "
"mov %%ax, %%fs; "
"mov %%ax, %%gs; "
::: "ax");
struct process_state_t *process_state;
asm("mov %%ebp, %0"
: "=r"(process_state));
printf("Preempted process %08x.\n", kernel_state.active_process);
apic_eoi();
next_process(&kernel_state, process_state);
}