TSS/TAsk Switch

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator: Moderators

TSS/TAsk Switch

Postby Insightsoft » Fri Aug 05, 2011 5:39 pm

Hi guys...

problem:
-I got 4 tasks, (each one a function with a endless loop printing his id), with own TSS...
-Are installed on GDT;
Code: Select all
.show gdt
   Idx  BaseHI  BaseLO  BaseMid Flags   Grand   Limit
   0    0x0     0x0     0x0     0x0     0x0     0x0
   1    0x0     0x0     0x0     0x9B    0xCF    0xFFFF
   2    0x0     0x0     0x0     0x93    0xCF    0xFFFF
   3    0x0     0x0     0x0     0xFA    0xCF    0xFFFF
   4    0x0     0x0     0x0     0xF2    0xCF    0xFFFF
   5    0xC0    0xB46B  0x0     0x89    0x0     0x67
   6    0xC0    0xB4E3  0x0     0x89    0x0     0x67
   7    0x0     0x2F76  0x0     0x89    0x0     0x67
   8    0xC0    0xC91B  0x0     0x8B    0x0     0x67
   9    0x0     0x0     0x0     0x0     0x0     0x0


How to start rolling the multitask?

I'm trying:
Code: Select all
-jmp (5*8):0
-timer/schedule(new task)
-it keep changing TR automatically and updating (busy flag on GDT). As you can see, entry 8 has 0x8B)


But I realize that bochs doesn't print that msg saying that a task switch has occurred;
And more, when comes the 2nd time of index 5... bocsh say: LOCK prefix unallowed (op1=0x53, modrm=0x00)


Thanks
_____________
Think it, build it, bit by bit...
Insightsoft
 
Posts: 63
Joined: Wed Jul 22, 2009 6:44 am

Re: TSS/TAsk Switch

Postby Andyhhp » Sat Aug 13, 2011 11:36 pm

The message from bochs means that you are attemping to use the LOCK prefix with an instruction where it is not valid.

Unless you have explicitly put in some handcoded asm (at which point you should be less confused about the error), this means that you are trying to execute data in memory.

I suggest you fix your program so that you jump to the correct locations to continue the tasks.

~Andrew
Image
Andyhhp
Moderator
 
Posts: 387
Joined: Tue Oct 23, 2007 10:05 am
Location: 127.0.0.1

Re: TSS/TAsk Switch

Postby Insightsoft » Sun Aug 14, 2011 11:04 pm

I'm confused...
Code: Select all
jmp     (5*8):0            -> Done... Ok
schedule...
jmp     (6*8):0            -> Done... (Task switch Ok)
schedule...
jmp     (7*8):0            -> Done... (Task switch Ok)
schedule...
jmp     (8*8):0            -> Done... (Task switch Ok)
schedule...
jmp     (5*8):0            -> Done... (Problem!!!)......................................second round!


I can't really understand what is wrong...

each task is a simple loop...
Code: Select all
void task1()
  for(;;)
    say '1';

void task2()
  for(;;)
    say '2';
...
_____________
Think it, build it, bit by bit...
Insightsoft
 
Posts: 63
Joined: Wed Jul 22, 2009 6:44 am

Re: TSS/TAsk Switch

Postby Insightsoft » Mon Aug 29, 2011 12:17 pm

Andyhhp wrote:The message from bochs means that you are attemping to use the LOCK prefix with an instruction where it is not valid.

Unless you have explicitly put in some handcoded asm (at which point you should be less confused about the error), this means that you are trying to execute data in memory.

I suggest you fix your program so that you jump to the correct locations to continue the tasks.

~Andrew


As you can see, on first jump it works properly. Why not on 2n jump? I'm not jumping to DATA!...
_____________
Think it, build it, bit by bit...
Insightsoft
 
Posts: 63
Joined: Wed Jul 22, 2009 6:44 am


Return to Beginning OS Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron