Page 1 of 1
Problem with TSS TASK switching
Posted: Tue Dec 06, 2005 12:00 am
by blackcatcoder
HI !
I hope anyone of you can help me!
I've implented the tss task switching 1 year ago, It worked fine on all emus but if i load my Os on a real pc or laptop it reboots after the the 5th task(some times after 6th) !
some facts:
I've set the system tss for the stack0 and stack3 !
Every task gets her own tss gdt entry!
The bitmap is initliazed and the user task gets dpl3 and so on...
The memory managment works fine, there are no errors considering this.
I also check if the memory is available with e820 map.
I've checked all things but I can't find any error.
Please help me !
Re: Problem with TSS TASK switching
Posted: Tue Dec 06, 2005 12:00 am
by Osbios
No code, no help!
Re: Problem with TSS TASK switching
Posted: Tue Dec 06, 2005 12:00 am
by blackcatcoder
the code more than 50 lines
thanks but I've solved the prob!
Re: Problem with TSS TASK switching
Posted: Tue Dec 06, 2005 12:00 am
by carbonBased
What was the issue?
Just in case someone else might stumble upon this in the future, it's always good to have this information out in the forum.
Cheers,
Jeff
Re: Problem with TSS TASK switching
Posted: Thu Dec 08, 2005 12:00 am
by blackcatcoder
The prob was that the pc reboots after every task creation except at the init task!
I forgot to look if the tss is bsy or not!
I solved it by setting it available but there is another
solution by returning to the task!
My best advice to every os coder is don't use emulators like vmware and so on !
Test your system on a real personal computer!
In my case the Os worked on all emus but on normal pcs it reseted!
Re: Problem with TSS TASK switching
Posted: Thu Dec 08, 2005 12:00 am
by carbonBased
I've had that exact same problem in the past
I don't know how safe it is to manually change the busy bit, though... I just iret, in that case.
Definitly a good idea to work on a real OS every now and then, though... if you want too long between revisions to test on a real PC you can get yourself in a nasty situation... "One of these million changes since last time is causing my PC to reboot!"
I'm bad for it, myself... haven't testing on a PC in a while. Prob'ly will tonight, now
Re: Problem with TSS TASK switching
Posted: Mon Dec 12, 2005 12:00 am
by blackcatcoder
This means a lot of work! (I see)!
I was wondering if I tested it on an AMD Athlon Mobile and it rebooted after the first task switch.
I've solved another problem that can cause a reboot at switching time!
If you detect the CPU and enable some extensions you have to do this for every CPU model.
I was too lazy to do this so I don't finished the cpu extensions!
I think it's better to change the task available bit cause in my scheduling method every task gets his own ticks and after a time slice there should be a task switch but in most cases the bit says that the task isn't available!
Re: Problem with TSS TASK switching
Posted: Mon Dec 12, 2005 12:00 am
by carbonBased
Either way you're not actually switching tasks, though... you're returning to the previously running task.
I'd imagine an iret would be considerably less expensive then jumping back to the same tss... the processor might optimize this case, but I haven't heard anything to suggest this yet.
--Jeff
Re: Problem with TSS TASK switching
Posted: Tue Dec 13, 2005 12:00 am
by blackcatcoder
hmm...
I tried to solve this with the bsy bit of the selector and with the iret then but i had one big problem my selector was always bsy so i worked around and it works fine.