I have interrupts, paging, and multitasking (with ring0 threads) working well. I can enter ring 3 from ring 0 and I can make and return from syscalls using software interrupt 0x80.
However, when I switch to ring 3 interrupts no longer fire. I don't get keyboard input or PIC ticks - so I can't multitask my ring 3 processes.
Code: Select all
switch_to_user_mode()
{
uint32_t *p_esp0 = get_tss_kernel_esp0_location();
(*p_esp0) = current_task->kernel_stack + KERNEL_STACK_SIZE;
asm volatile(" \
cli; \
mov $0x23, %eax;\
mov %eax, %ds; \
mov %eax, %es; \
mov %eax, %fs; \
mov %eax, %gs; \
\
pushl $0x23; \
\
mov 0x1fffffff, %eax; \
pushl %eax; \
\
pushf; \
pop %eax; \
or %eax, 0x200; \
push %eax; \
\
pushl $0x1B; \
\
push $1f; \
\
iret; \
1: \
");
}
Doesn't "pushf; pop %eax; or %eax, 0x200; push %eax;" re-enable the interrupts when iret is called?