Real Initialized Output Debug Thing?? System Messages

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
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Real Initialized Output Debug Thing?? System Messages

Post by Octacone »

Hey everybody. I am wondering how do system messages work?
Here is an example:
qst.png
I really have no idea how that works. I think that would be helpful, you could see if everything initialized as you expected.
But how do I see if my paging, gdt, isr are working and how to output a message saying if it worked or not?
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Real Initialized Output Debug Thing?? System Messages

Post by Brendan »

Hi,
thehardcoreOS wrote:Hey everybody. I am wondering how do system messages work?
Here is an example:
qst.png
I really have no idea how that works. I think that would be helpful, you could see if everything initialized as you expected.
But how do I see if my paging, gdt, isr are working and how to output a message saying if it worked or not?
I typically have a "big string in memory", allow pieces (device drivers, etc) to append characters to it, and allow pieces to ask to be notified when something is appended so they can display it when it's changed (whether that means displaying it on a monitor, or sending it to a serial port, or whatever else). Periodically (at the end of boot, and "occasionally" after that) I write the entire "big string in memory" to the file system (as a file) and discard the oldest part (otherwise it'd keep growing and be like a memory leak).

Note that when you've got multi-tasking and/or multi-CPU working the "append" has to be atomic; and you can't (e.g.) append "Hello" and then append " World!\n"; and have to append "Hello World!\n" in a single operation to ensure that nothing else is added in the middle and you can't end up with something like "HelloUSB device #1234 found\n World\n". This means that for things like (e.g.) displaying a list of detected PCI devices you have to construct it in a buffer and then append the buffer.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Real Initialized Output Debug Thing?? System Messages

Post by Octacone »

Brendan wrote:Hi,
thehardcoreOS wrote:Hey everybody. I am wondering how do system messages work?
Here is an example:
qst.png
I really have no idea how that works. I think that would be helpful, you could see if everything initialized as you expected.
But how do I see if my paging, gdt, isr are working and how to output a message saying if it worked or not?
I typically have a "big string in memory", allow pieces (device drivers, etc) to append characters to it, and allow pieces to ask to be notified when something is appended so they can display it when it's changed (whether that means displaying it on a monitor, or sending it to a serial port, or whatever else). Periodically (at the end of boot, and "occasionally" after that) I write the entire "big string in memory" to the file system (as a file) and discard the oldest part (otherwise it'd keep growing and be like a memory leak).

Note that when you've got multi-tasking and/or multi-CPU working the "append" has to be atomic; and you can't (e.g.) append "Hello" and then append " World!\n"; and have to append "Hello World!\n" in a single operation to ensure that nothing else is added in the middle and you can't end up with something like "HelloUSB device #1234 found\n World\n". This means that for things like (e.g.) displaying a list of detected PCI devices you have to construct it in a buffer and then append the buffer.


Cheers,

Brendan

Thanks for explaining that. :D Btw I am wondering how to see if something is initialized or not?
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Real Initialized Output Debug Thing?? System Messages

Post by BrightLight »

thehardcoreOS wrote:Btw I am wondering how to see if something is initialized or not?
Just print a debug message after every operation. Then, when something goes wrong, you can see the debug messages to see what happens. A register dump is very useful here.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Post Reply