Task switch problem...

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.
Post Reply
Ozguxxx

Task switch problem...

Post by Ozguxxx »

Hi people, when I try to do a very simple task switch in bochs, it gives an error like:

...
00000330071i[KBD ] reset-disable command received
00000506022e[HD ] device set to 0 which does not exist
00000506315e[HD ] device set to 1 which does not exist
00000713774i[CPU ] task_switch: bad LDT fetch
00000713774i[CPU ] task switch: posting exception 10 after commit point
00000713774p[CPU ] >>PANIC<< can_push(): SS invalidated.
00000713774i[SYS ] Last time is 1044651487
00000713774i[CPU ] protected mode
00000713774i[CPU ] CS.d_b = 32 bit
00000713774i[CPU ] SS.d_b = 32 bit
00000713774i[CPU ] | EAX=000000ec EBX=00000100 ECX=00163c00 EDX=00000100
00000713774i[CPU ] | ESP=0000ffff EBP=00000000 ESI=0000395f EDI=00000005
00000713774i[CPU ] | IOPL=0 NV UP DI PL NZ NA PE NC
00000713774i[CPU ] | SEG selector base limit G D
00000713774i[CPU ] | SEG sltr(index|ti|rpl) base limit G D
00000713774i[CPU ] | DS:0010( 0002| 0| 0) 00001000 000fffff 1 1
00000713774i[CPU ] | ES:0010( 0002| 0| 0) 00001000 000fffff 1 1
00000713774i[CPU ] | FS:0010( 0002| 0| 0) 00001000 000fffff 1 1
00000713774i[CPU ] | GS:0008( 0001| 0| 0) 00001000 000fffff 1 1
00000713774i[CPU ] | SS:0010( 0002| 0| 0) 00001000 000fffff 1 1
00000713774i[CPU ] | CS:0018( 0003| 0| 0) 00001000 000fffff 1 1
00000713774i[CPU ] | EIP=000000e7 (000000e7)
00000713774i[CPU ] | CR0=0x60000019 CR1=0x00000000 CR2=0x00000000
00000713774i[CPU ] | CR3=0x00000000 CR4=0x00000000
00000713774i[ ] restoring default signal behavior
00000713774i[CTRL ] quit_sim called with exit code 1


Any ideas? Thanx...
Therx

Re:Task switch problem...

Post by Therx »

It's hard to tell without seeing your exact code but
00000713774p[CPU ] >>PANIC<< can_push(): SS invalidated.
suggests that you aren't updating the stack registers after a switch. Each task needs it's own stack and you must restore ALL registers to the state they were in when you left the task.
Post Reply