Page 1 of 1

problem with a simple task-switch

Posted: Sat Jul 17, 2004 9:49 am
by rumpel
Hi.
I'm trying to perfom a single task-swith to a test prozess which should hang, but it allways says general protection fault.
http://nopaste.php-q.net/71991

mfg, rumpel.

Re:problem with a simple task-switch

Posted: Sat Jul 17, 2004 12:17 pm
by Pype.Clicker
question is, *where* does it GPF ? Got a look to the Guru Meditation in a Nutshell page already?

Re:problem with a simple task-switch

Posted: Mon Jul 19, 2004 1:01 pm
by rumpel
hi

"// the code runs fine till the far-jamp to gdt 0x30"

I wasn't sure about it, but I've expanded my int handler a bit now so that its sure. I've written a function to put out plain memory and it seems as everything (gdt, tss, test) are at the right place. Perhaps I've forgotten to fill out some fields of the tss needed to run ?
Other case: when i load a empty/uninitialised tss and then do a far-jump to that tss, the cpu fills out the tss before the jump and the code after should be executed as before I thought, but this doesn't work too.
Anyone perhaps a idea what could be wrong ?

mfg, rumpel.

Re:problem with a simple task-switch

Posted: Tue Jul 20, 2004 2:54 am
by Pype.Clicker
   db 0xea ; jump to new prozess (tss2, _test)
   dw 0
   dw 0x30
i think you should use 'jmp far' rather than toying with db, dw etc.
afaik, in 32 bits mode, the offset should be a dword, not a word.

ps: having the code only out of the forum doesn't really help. If you could at least show here the snippets that you suppose being wrong, it would make things easier to read ...

Re:problem with a simple task-switch

Posted: Sat Jul 24, 2004 4:24 pm
by rumpel
s: having the code only out of the forum doesn't really help. If you could at least show here the snippets that you suppose being wrong, it would make things easier to read ...
sry. The problem was that I've had absolutly no idea where the error could be. BUT ! you're right ... I've changed the 0xea thing and it works :D thanks a lot.

mfg, rumpel.