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
Software Multitasking
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
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).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");
-
- Member
- Posts: 89
- Joined: Tue Feb 26, 2008 10:47 am
- Location: Sweden
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...)
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...)