Page 4 of 4

Posted: Wed Jun 06, 2007 1:17 pm
by JAAman
i assumed you were using software task-switching, since most people do (its easier to get it working correctly, and faster... sometimes... maybe...) -- and the code you have posted seems to agree


ya you should, CS is the only segment selector stored on stack without privilege change, and its only CS and SS with a privilege change, so you should be popping 0 into DS, which will GPF...

idk why its working... it shouldnt be

unless the code your iret returns to isnt using DS... that is possible -- actually, that is quite likely, a lot of simple code wont (the kind used to test multi-tasking)

Posted: Wed Jun 06, 2007 1:32 pm
by Lprogster
...

Posted: Wed Jun 06, 2007 1:43 pm
by JAAman
almost -- there are exceptions: iirc any address using BP uses SS (which is quite common in compiled code), and there are a few instructions that use alternate segment registers (like the string instructions use ES:DI)

but was the user code compiled or assembled? because for short sections of code, the compiler could easily keep variables in registers instead of memory, or could use special instructions which dont reference DS

im thinking this is the most likely reason, as you should get a GPF if DS is being used

or maybe your GPF handler isnt working correctly, and you just dont realize that your getting one... :lol:

Posted: Wed Jun 06, 2007 2:30 pm
by Lprogster
I'm beginning to get somewhere now - the intel manuals are really very good. I really need a good tutorial, though - if anyone knows one?

Thank you loads jnc, AJ, JAAman and others,
Lster