Hi!
Would someone please help me understand this piece of code which I
found online:

http://ringzero.free.fr/os/protected%20mode/Pm/PM9.ASM

First of all, I think it doesn't work the way it should, because when
you run it (needs to be run under dos with himem disabled), you never
actually get to see the message "(Hello from task 1 )".
I think that is because the "jmp USER_TSS:0" instruction is never
successfully executed.
Also, what I don't really understand is why the processor is first
switched to ring3 before doing the jump to task 1. Why can't the jump
to task 1 be done directly from ring 0??
And the last point that I dont get is the following: the task selector
USER_TSS is defined as "USER_TSS equ $-gdt"
Now, imagine the gdt was at position 0 in memory..then USER_TSS in this
case would be at position 48..whereas "actually" it should be 6 because
it is the 6th selector in the gdt and as far as I know, the offset is
later multiplied by the size of the descriptor when locating the tss
descriptor in the gdt, see what I mean? Also, as far as I understand,
the last three bits in a selector are not for the offset but for the
selector pl and I dont see where these are set for USER_TSS...Does
anyone understand what i mean? Does anyone fully understand this piece
of code?
Can you please tell me what needs to be changed here in order to run
this the way it should? 'm still trying to come to grips with
protected mode...
Thanx very much!
Martin