but was it necessary? cli and sti are already used in the glue code...
so does it make sense to actually enable interrupt?
this could actually introduce recursive interrupt, an interrupt that interrupt another ISR
Code: Select all
// Here we:
// * Stop interrupts so we don't get interrupted.
// * Temporarily put the new EIP location in ECX.
// * Load the stack and base pointers from the new task struct.
// * Change page directory to the physical address (physicalAddr) of the new directory.
// * Put a dummy value (0x12345) in EAX so that above we can recognise that we've just
// switched task.
// * Restart interrupts. The STI instruction has a delay - it doesn't take effect until after
// the next instruction.
// * Jump to the location in ECX (remember we put the new EIP in there).
asm volatile(" \
cli; \
mov %0, %%ecx; \
mov %1, %%esp; \
mov %2, %%ebp; \
mov %3, %%cr3; \
mov $0x12345, %%eax; \
sti; \
jmp *%%ecx "
: : "r"(eip), "r"(esp), "r"(ebp), "r"(current_directory->physicalAddr));
}