Page 3 of 3

Posted: Wed Feb 27, 2008 12:25 pm
by JamesM
Hi,

try running through the tutorial I just finished, from which that code was based, and reply back if you still can't find the problem.

http://www.jamesmolloy.co.uk/tutorial_h ... sking.html

Posted: Thu Feb 28, 2008 3:46 am
by pcmattman
thomasloven wrote:

Code: Select all

   asm volatile("cli");
   asm volatile("   \
   mov %0, %%ecx;   \
   mov %1, %%esp; \
   mov %2, %%ebp;   \
   mov $0x12345, %%eax;   \
   jmp *%%ecx;      " : : "r" (eip), "r"(esp), "r"(ebp));
   switch_page_directory(current_directory);
   asm volatile("sti"); 
Something tells me you don't understand this code - the switch_page_directory and sti don't ever execute. Try to figure out a better place to put them (hint: that jmp *%%ecx is what will jump to the task, so nothing after it will execute).

Posted: Thu Feb 28, 2008 10:10 am
by thomasloven
I tried that too.
The code I posted is a bit messed up from my attempts to make it work.
The jump there is actually commented out and replaced by another one a bit later in the code which I for some reason removed in my last code...

Edit

I got it runing now.
There were a few problems with my code for copying the page tables due to me keeping the kernel in higher half of memory.

However; now, for some reason, the child task does not run interrupts (i.e. the PIT)...
It switches fine if I do it manually, and the main thread switch runs interrupts and switch back by itself with no problems.

Will keep working.

And: yes, I did try with "sti".

Edit again
Working now.
Thanks a lot for your help, and especially JamesM for yet another amazing tutorial.
Finding those was what actually made me pick up osdeving again after several years. (which is also why I risk failing at university now...)