Monday, May 22, 2006

a short update

I can print page tables correctly now. This is good because it's the first time I can practically display page tables in operation and it shows I've understood how the hierarchy works. One complication in L4 is that the page tables themselves have a virtual to physical mapping, i.e. they're not flat mapped. So each entry in a 1st level table must first be converted to its virtual address before accessing. Anyways, will try to fix the spurious irq problem now.

I think there may be some point re-writing the kernel in C. I'm not competent enough to do so yet, but it would 1) Help understand how it works - this is the major reason, 2) C is better than C++ - unfortunately I think this fact is true for system level software. The first benefit I would have is, C code in linux kernel style is more readable. C++ just isn't. So, at least the sources are there to read in case there's no documentation. Usually in details there's never documentation anyways. The biggest problem I'm having now with understanding L4 is the c++ sources. c++ hides the implementation by using high-level clauses, whereas you want to see the exact implementation and C just does that to the right amount of detail. Certainly you don't want to know which register is used for what most of the time so you don't need assembly. But I think going lower-level as in C helps understanding the code. This is especially crucial in system-level software I think. Enough chit chat, back to work now.

Sunday, May 21, 2006

Goddamn it!

3 minutes ago I have found the problem why root task would give a memory abort when accessing the utcb. I cannot believe how much time I spent looking for why this would occur. I've been checking the page table setup for the last two weeks and was about to give up. Damn it, everything was OK! I forgot to disable vector catching in the debugger, and ta™! it just works now. The bit that I overlooked was page faults are sometimes legitimate. Now, what I have: Sigma0, roottask and idle thread are started, (at least that's what the printfs say) also I am getting some repetitive spurious irqs but that's ok, the irq code is not debugged. Now, todo:
1) Fix irq handlers, timer operations.
2) Make sure scheduling is healthy.
3) Also make sure hello task is operational, printing some messages.
4) Add some driver tasks. (KMI, CLCD and a userspace UART driver would be the priorities)
5) I must investigate further on memory management and memory offsets, tcbs etc.
6) Send patches back to the community.