problem with a simple task-switch

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
rumpel

problem with a simple task-switch

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:problem with a simple task-switch

Post by Pype.Clicker »

question is, *where* does it GPF ? Got a look to the Guru Meditation in a Nutshell page already?
rumpel

Re:problem with a simple task-switch

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:problem with a simple task-switch

Post 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 ...
rumpel

Re:problem with a simple task-switch

Post 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.
Post Reply