If this is old news, or the there is something on the wiki (though I haven't seen it yet) I would very much appreciate the link.
I'm porting the latest iteration of my kernel to C++.
I followed http://wiki.osdev.org/C%2B%2B and all was well. Then I made a Video class to handle video output and all was well. DTs, ISRs, IRQs done. After that I wrote my PMM which allocates a frame bitmap after the kernel (I use the linker script to insert a symbol at the end) and zero it out. i call pmmInit and again all is well. Then I decided it would be great if the Video class was a singleton, because that would be really cool So I checked out some articles and came up with a Video singleton like this
Code: Select all
class Video
{
public:
//! Video memory start at 0xb8000.
const uint32_t videoMemStart;
//! The tab width in spaces.
const uint32_t tabWidth;
public:
//! @brief Returns the one and only instance of the object.
inline static Video& instance()
{
static Video video;
video.print("!!!!! 0x").putUnsigned((uint32_t)&video, true).newLine();
return video;
}
/* implementation */
protected:
//! Default constructor.
explicit Video();
//! Default destructor.
~Video();
private:
explicit Video(Video const&);
Video& operator=(Video const&);
};
AFAIK static variables are placed in the bss section. Is this also true for static variables which are not arithmetic types or pointers?
Is there anything else I'm missing?
I'm stuck, so any info is welcome.
rJah