XyrisOS / xyris

The Xyris Kernel
https://xyr.is
MIT License
153 stars 11 forks source link

Fix Global Constructors #168

Closed Kfeavel closed 3 years ago

Kfeavel commented 3 years ago

The global constructor function isn't getting called and based on the information from the OSDev Wiki, we're not doing anything the way they recommend.

https://wiki.osdev.org/Calling_Global_Constructors

https://wiki.osdev.org/C%2B%2B

Kfeavel commented 3 years ago

Okay, so looking at loader.s for Panix v2 (which @JamesOrson should be quite familiar with), the global constructors are called by simply calling callConstructors, which is found in kernel.cpp. This, however, is not anything like how the OSDev Wiki says to do it. If we want to do it the way Panix v2 did, then it's as simple as calling px_call_constructors in boot.s, but if we want to do things by the books, we're going to need to do a bit more work.