Closed yuvraj1803 closed 1 year ago
In src/keyboard/classic.c
In line 92, task_page() is called.
In src/task/task.c
In line 191, task_page() calls task_switch(current_task). But current_task can be NULL, because,...
In src/task/task.c:13 It was initialised as NULL.
This leads to an invalid page directory being loaded (see below)
task is NULL, and task->page_directory is being loaded into CR3
I hope this makes it clear :)
Suggested fix:
In src/keyboard/classic.c:
Line 92: if(task_current()) task_page();
Hello, I don't believe this to be an issue because their isnt a senario where their cant be a task. If I remember correctly if the program crashes a new task is spawned, you are welcome to put a panic in your code if you wish but I don't beleive this is neccessary. I did write the kernel a while ago so if you believe I'm wrong on that if you can show me I can look into it further, however I do not see a cause for a concern in this regard given that their will always be a task running. Even when a task is killed I believe we spawn another task
Thanks Dan
In src/keyboard/classic.c: line 92
task_page() is called.
When there is no task running, and the keyboard interrupt occurs, current_task is NULL/garbage. CR3 is loaded with some garbage value causing unexpected behaviour.
Regards, Yuvraj Sakshith