Page 1 of 1

Paging and Multitasking...

Posted: Mon Aug 05, 2002 11:00 pm
by carbonBased
I'm having issues with my kernel :)

I've had TSS-based multitasking implemented for some time now, and I just recently incorporated paging (with a simple, linear = physical mapping for the first 4MB), and the two simply don't get along.

It _seems_ that the paging mechanism is working perfectly until a task switch attempts to occur.  I can successfully load and link-in all my run-time modules with paging enabled, but as soon as I set-up the timer (and therefore the scheduler), it hangs.  No GPF, exception, or anything... just does nothing, eventually clearing the screen, which eventually led me to believe that it was a corrupted page table, and the kernel was jumping to an incorrectly mapped page and running random code... but then my other kernel functions wouldn't work either, but they do.

Perhaps I'm missing something...

I have PL0 and PL3 tasks
Each task has CR3 defined to the same page directory
The page dir/table defines the U/S bit, so pages are accessable by PL3 tasks
All pages are read/write

My TSS's _might_ be spanning a 4KB boundary... but each page is mapped, so that shouldn't be an issue, should it?

Any help would be greatly appreciated... I used to think paging was easy :)  Implemented it in about 20 minutes in my last kernel...

Jeff

RE:Paging and Multitasking...

Posted: Mon Aug 05, 2002 11:00 pm
by carbonBased
My god... folks, I am an idiot :)

All's good on the paging front!

You know, every time I seem to search for the bug for hours on end, and finally decide to post a message on this board... and then withen five minutes, I find that bloody bug!

For anyone that's interesting, here's the offending line, in setCR3:
setCR3:
        push ebp
        mov ebp, esp
        push eax
        mov eax, [ss:bp+8]  << -- BP!?   Nope, should be ebp!!!
        mov cr3, eax
        pop eax
        pop ebp
        ret

That _stupid_ typo brought down my entire system!

I'm busy searching through my task switching code, and triple checking my page directories and tables, and... looking over EVERYTHING!... everything but THAT!

LOL!

That's exactly why I have such a love/hate relationship with this field ;)

Cheers,
Jeff