task switching

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.
udarkman

Re:task switching

Post by udarkman »

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
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:task switching

Post by Pype.Clicker »

uh!? that's quite weird ... i would say that something in your code damaged the tasks description before LLDT is issued.

maybe you should get a look at where stack32_end is located ... 256 bytes of stacks looks pretty small, imho.
Post Reply