Saturday, April 29, 2006

L4 almost booting

Recent changes: I first learned and practiced how to load an elf image into memory. It is actually not that complicated. The elf header tells where the image entry address is, and where to find all sections in the file. Each section has a program header. The program headers define where each section is to be loaded in memory. In L4 case, the kernel, the hello application, and server tasks each are included in a separate section and their program loaders point at where they're to be loaded. The rest of the play is finding out where each section lies in the image, and copying them into the correct addresses in memory, and jumping into the entry address. That's it.

I got that working now. The tricky bit was that the main memory starts from address 0x0, but loading the image there caused problems. The other issue is that the loader must not run on addresses where the image need to be loaded. Otherwise it would overwrite itself and the result would be undefined.

After dealing with all these, the image boots now. Second thing I did was to add printing routines for the uart, the routines that work both when the vmem is enabled and disabled. They're assembly routines that check whether the mmu_is_on() and refer to uart base address, and the string pointer passed in r0 either as they are, or by adding a vmem offset to them. It works well. The only gray region is when the vmem is enabled but the uart area hasn't been mapped and therefore inaccessable. In that case you simply don't print anything.

The initialisation goes well, up until printing the TID of a roottask (or sigma0?) I will debug it this weekend. But the actual thing is, I am so glad to have gone through the initial steep learning curve, and I actually got to practice the whole system in operation. This is going to get me going much faster than before now. Also in the past weeks, I found the cause of a bug in the linux kernel that affected mpcore booting, and that had been searched for quite some time, which is good progress. I also learned how to code for inclusion in the kernel, I got the style of writing kernel code. My next patch will have good chance to get accepted I hope. Things to do: I need to do more python work, learn scons and kenge. I need to get L4 working, and submit a patch to maintainers. I need to learn stacked git and get better on git patch management. I need to add debug section support to dite, so I can follow symbols from the debugger.

0 Comments:

Post a Comment

<< Home