Interrupts are handled incorrectly while the user space work
Posted: Tue Sep 08, 2020 7:33 am
Hi.
My scheduler successfully passes control to the user program on Ring 3, but when this function is running in user mode, I get an interrupt from PIT, but there are problems in the handler.
For example, the interrupt number is determined incorrectly, just like other information related to the interrupt.
And now I'll tell you more:
The scheduler calls the scheduler_low_thread_switch() function, which stores data from the interrupted current task in current_thread and starts either a new task(next_thread), this function also determines whether the task is a user mode task.
In my case, it successfully runs a custom task in Ring 3 and it works fine(i go to ring 3 using this function), but there is a 32 interrupt from PIT.
In this case, the handler for the interrupt is called, it successfully calls isr_handler(), but the interrupt number is too large, and all other registers fields are invalid.
In addition, the handler tries to print the number of the unprocessed interrupt, but some problem occurs during its processing and because the handler is not completed correctly, the interrupts remain disabled and the system freezes.
Just in case, I recorded it on video, maybe it will be a little clearer there.
At the end of the video, you can see that this interruption is from PIT.
There are 4 of them after setting up multitasking, each time the task is switched.
0(kernel)->1(kernel)
1(kernel)->2(kernel)
2(kernel)->3(user mode)
3(user mode)->0(kernel) <-this is what is being processed incorrectly(int_num invalid)
What could be the problem?
My scheduler successfully passes control to the user program on Ring 3, but when this function is running in user mode, I get an interrupt from PIT, but there are problems in the handler.
For example, the interrupt number is determined incorrectly, just like other information related to the interrupt.
And now I'll tell you more:
The scheduler calls the scheduler_low_thread_switch() function, which stores data from the interrupted current task in current_thread and starts either a new task(next_thread), this function also determines whether the task is a user mode task.
In my case, it successfully runs a custom task in Ring 3 and it works fine(i go to ring 3 using this function), but there is a 32 interrupt from PIT.
In this case, the handler for the interrupt is called, it successfully calls isr_handler(), but the interrupt number is too large, and all other registers fields are invalid.
In addition, the handler tries to print the number of the unprocessed interrupt, but some problem occurs during its processing and because the handler is not completed correctly, the interrupts remain disabled and the system freezes.
Just in case, I recorded it on video, maybe it will be a little clearer there.
At the end of the video, you can see that this interruption is from PIT.
There are 4 of them after setting up multitasking, each time the task is switched.
0(kernel)->1(kernel)
1(kernel)->2(kernel)
2(kernel)->3(user mode)
3(user mode)->0(kernel) <-this is what is being processed incorrectly(int_num invalid)
What could be the problem?