Call initialization functions automatically

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
triple.fault
Posts: 3
Joined: Tue Mar 04, 2008 10:52 am

Call initialization functions automatically

Post by triple.fault »

Hey OS developers,

I’ve just started to develop a small kernel to advance my coding skills. I thought that it would be a good start to take a look at the Linux kernel sources. This helped me to get familiar with the basic parts of a kernel. After some weeks of reading articles, forum posts, etc. and of course writing code my kernel will just print a “Hello worldâ€
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Try putting kprintfs in certain places to see where the time is being spent. It's certainly not being spent on one call/ret pair. Maybe seven thousand exceptions/resolutions are taking place?
triple.fault
Posts: 3
Joined: Tue Mar 04, 2008 10:52 am

Post by triple.fault »

Hey JamesM,
JamesM wrote:Try putting kprintfs in certain places to see where the time is being spent.
I put some kprintfs into one of my initialization functions. As soon as I've booted the kernel, the same problem appears. I have to wait about 6 minutes until the function will return and the next one will be called. All kprintfs will appear at the same time. So I cannot localize the problem inside my initialization function. I have no idea where I should search for this problem :( .
JamesM wrote:Maybe seven thousand exceptions/resolutions are taking place?
But would the emulation software not write something to the log, that a exception appeared or even also shows up the same strange behavior than a real computer? I also have set up the IDT (interrupt handlers) and it seems that no handler will be called. If the CPU caused an exception, one of the handlers should be called, or am I wrong?

Thanks a lot,
Tim
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Well, if you have set up an IDT then bochs normally doesn't log every interrupt. Only unhandled ones / double faults. Qemu doesn't record anything.
triple.fault
Posts: 3
Joined: Tue Mar 04, 2008 10:52 am

Post by triple.fault »

Ok, thanks for this information. I thought that bochs would log the exceptions anyway.

But back to the topic: It seems that the bug was in the code which called the initialization functions. Particularly in the kdebug function which tried to write some debugging stuff to the serial port. It seems that this method took a long time to execute. After removing the function calls, the initialization stuff works great.

Thanks for taking a look on my problem.

Regards,
Tim
Post Reply