docs: documented Panic screen output

This commit is contained in:
antifallobst 2023-02-12 10:22:25 +01:00
parent 5eab21e98a
commit a57f2c25de
1 changed files with 56 additions and 0 deletions

View File

@ -45,6 +45,62 @@ When the Computer is in paging mode, only mapped pages are accessible.
Now every Process gets its own page table and tada: we have successfully isolated the processes from each other, Now every Process gets its own page table and tada: we have successfully isolated the processes from each other,
because every process can only access the data that it needs to access. because every process can only access the data that it needs to access.
## Panic screen
When a fatal / not recoverable error occurs, the kernel panics. It logs panic information and then halts forever.
Such a panic log can look like the following one:
```
[ Error ] !=====[ KERNEL PANIC ]=====!
Interrupt ID: 0x0E
Error Code: 0b00000000000000000000000000000010
Error Message: Page Fault
Paging Info:
Page Map: 0x000000000FB0A000
CPU Flags:
Parity
Sign
CPU Registers:
RIP: 0xFFFFFFFF8000027A RAX: 0x0000100000079838 RBX: 0x0000000000000000
RCX: 0xFFFFFFFFFFFFFFD8 RDX: 0x0000000000000000 RSI: 0x0000000000000000
RDI: 0x0000100000079838 RBP: 0xFFFF80000FB1AF10 RSP: 0xFFFF80000FB1AEF0
[ Warning ] !=====[ HALTING SYSTEM ]=====!
```
but what does it say?
In most cases, a panic occurs while handling an interrupt.
If this is the case, we will have the state of the cpu while it was interrupted.
This cpu state provides us very much information.
`Interrup ID` tells us, which interrupt caused the panic.
In this case the ID is `0x0E`, a `Page Fault Exception`.
`Error Code` is a binary representation of the 32 least significant bits of the error code pushed by some interrupts.
If an interrupt pushes no error code, this will be just zeros.
In our example the code tells us, that the error happened because of a write attempt to a not present page.
`Error Message` tells us, what happened.
`Paging Info` contains all information about paging.
At the moment, this is just the physical address of the loaded page map.
`CPU Flags` contains information about which bits are set in the CPU status register.
If this block doesn't appear, there are no bits set.
`CPU Registers` contains the data, in the main cpu registers.
This is probably the most interesting block, because you get very detailed information out of here,
if you know what each of these registers does in the cpu.
### Panic without interrupt
If the panic wasn't caused by an interrupt, it has no cpu_state, and because of that it has no detailed info about the execution state.
In this rare case, you will get the following message:
```
No detailed Information available (cpu_state null reference)
```
The `Error Message` could still be helpful, but good luck finding that bug.
## Format strings ## Format strings
Format strings are strings that are formatted at runtime. Format strings are strings that are formatted at runtime.
They are created by defining a pattern, like the following one: They are created by defining a pattern, like the following one: