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)
Virtual Addressing...
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...![Laughing :lol:](./images/smilies/icon_lol.gif)
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...
![Laughing :lol:](./images/smilies/icon_lol.gif)