software based task switching help needed
Posted: Tue May 20, 2003 5:59 pm
folks,
i've lurked for a few days looking for the right answer. i've search tutorials up and down and have read both Operating Systems design and implementation and protected mode software architecture. for the most part all my questions have been answered by these resources except for two. the only reason they aren't answer is because i'm confused and sometimes it just takes the right example to get my lightbulb lit.
question 1: software based task switching
on taskCreate i am doing the following:
on schedule i am doing the following:
this seems to work okay for the most part. it task switches from the idle task to task 1, but when it tries to go back i run into a page fault, followed by a general protection fault.
any ideas? if you need more code or context please ask
my setjmp and longjmp are taken from OSD.
question 2: vm86
i am using grub for my bootloader so i'm already in protected mode. i am trying to understand [baby steps - i read about this ALOT] how to to vm86 mode. i understand the concept and i understand parts but don't know where to exactly start, and i mean START.
thank you in advance for any help.
dennis
i've lurked for a few days looking for the right answer. i've search tutorials up and down and have read both Operating Systems design and implementation and protected mode software architecture. for the most part all my questions have been answered by these resources except for two. the only reason they aren't answer is because i'm confused and sometimes it just takes the right example to get my lightbulb lit.
question 1: software based task switching
on taskCreate i am doing the following:
Code: Select all
setjmp(task[i].stack);
address = (unsigned long)(stack[i] + USER_STACK_SPACE);
task[i].active = TRUE;
task[i].stack[0].esp = address;
task[i].stack[0].eip = fptr;
task[i].stack[0].eflags = 0x200;
task[i].priority = priority;
Code: Select all
/* save off the old task */
setjmp(task[activeTask].stack);
/* set the current next task to current */
activeTask = valueHolder;
/* set the new stack */
longjmp(task[valueHolder].stack, 1);
/* jump back kiss myself */
asm("ret");
any ideas? if you need more code or context please ask
my setjmp and longjmp are taken from OSD.
question 2: vm86
i am using grub for my bootloader so i'm already in protected mode. i am trying to understand [baby steps - i read about this ALOT] how to to vm86 mode. i understand the concept and i understand parts but don't know where to exactly start, and i mean START.
thank you in advance for any help.
dennis