Page 1 of 1
Real Initialized Output Debug Thing?? System Messages
Posted: Sun Mar 13, 2016 3:29 pm
by Octacone
Hey everybody. I am wondering how do system messages work?
Here is an example:
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?
Re: Real Initialized Output Debug Thing?? System Messages
Posted: Sun Mar 13, 2016 8:00 pm
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
Re: Real Initialized Output Debug Thing?? System Messages
Posted: Tue Mar 15, 2016 11:33 am
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.
Btw I am wondering how to see if something is initialized or not?
Re: Real Initialized Output Debug Thing?? System Messages
Posted: Tue Mar 15, 2016 11:37 am
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.