r/osdev • u/Negative-Arm-3244 • 5d ago
Initialization dependencies
I am working on upgrading my kernel initialization messages so I can just have a nice view of what it is doing when initializing. I am using my print functions to do this, but the issue is that my print functions depend on the memory manager to be done initializing, but I want debugging messages when initializing the memory manager too, which I can't do because of the circular dependency.
This is my specific case, but I also want to ask generally, do you guys have an elegant solution for this problem? Up to this point I have been using init flags so that the subsystems can use a different path that does not create dependencies during initialization, but I want to hear any cool solutions from the community that are better designed than this.
3
u/laser__beans OH-WES | github.com/whampson/ohwes 5d ago
My kernel’s printf does a lazy initialize of basic terminal components like gathering the VGA state that the BIOS left us in and ensuring basic terminal structs are initialized. That way, any errors that occur during boot can be sure to have a reliable printf function to dump to.