Im trying to implement multitasking for 2 weeks but I can not managed to implement it successfully. After enabling scheduling mechanism, my os restarts in bochs. I can not find what is wrong. Im adding my taskmanger code. Ill be happy if someone examines it.
[attachment deleted by admin]
multitasking
Re:multitasking
A very first thing is that:
Is problematic imo because esp should point to end of stack, I mean stack grows downwards, when you push sth cpu DECREASES esp and movs sth into stack memory. So following might help:
Also I might have missed it but where do you set cr3 register while adding a new task?
I hope these help, good luck.
Code: Select all
task[TotalTaskNumber].TaskTSS.esp = (unsigned int) Malloc(0x3000);
Code: Select all
task[TotalTaskNumber].TaskTSS.esp = (unsigned int) ( 0x3000 + Malloc(0x3000));
I hope these help, good luck.
Re:multitasking
Well in 386 programmer's reference it is told that cr3 is not saved into tss while cpu does a task dispatch so you have to set it manually at the process creation.
Re:multitasking
Yes, when I load cr3 register my multitasking worked. But the task I load in tr register with tr is not working, but other tasks works well. If I comment out that line, the line I load tr, all my tasks works well. Dont I have to load tr even once? Why is the task I load in tr not working?
Re:multitasking
OK, read this thread: http://www.mega-tokyo.com/forum/index.p ... 98;start=0