Re:task switching
Posted: Sat May 24, 2003 3:36 am
Hey, I solved the problem. I think it is mandatory to initialize tasks after lldt instruction. Dont know why but my problem solved when I init my tasks after lldt.
mov ax, 0
lldt ax
;initialization of tasks...
mov [MainTaskTSS.strace], 0
mov [Task1TSS.strace], 0
mov [Task2TSS.strace], 0
mov [MainTaskTSS.sio_map_addr], 0
mov [Task1TSS.sio_map_addr], 0
mov [Task2TSS.sio_map_addr], 0
mov [MainTaskTSS.sldtr], 0
mov [Task1TSS.sldtr], 0
mov [Task2TSS.sldtr], 0
mov [Task1TSS.sfs], 0
mov [Task2TSS.sfs], 0
mov [Task1TSS.sgs], 0
mov [Task2TSS.sgs], 0
mov [Task1TSS.sds], Data32SegmentSelector
mov [Task2TSS.sds], Data32SegmentSelector
mov [Task1TSS.ses], Data32SegmentSelector
mov [Task2TSS.ses], Data32SegmentSelector
mov [Task1TSS.sss], Data32SegmentSelector
mov [Task2TSS.sss], Data32SegmentSelector
mov [Task1TSS.sesp], (offset stacktask1+1024)
mov [Task2TSS.sesp], (offset stacktask2+1024)
mov [Task1TSS.scs], Code32SegmentSelector
mov [Task2TSS.scs], Code32SegmentSelector
mov [Task1TSS.seip], offset Task1
mov [Task2TSS.seip], offset Task2
mov [Task1TSS.seflags], 202h
mov [Task2TSS.seflags], 202h
mov ax, MainTaskSelector
ltr ax