Pineconium / ChoacuryOS

A WIP custom built OS
GNU General Public License v3.0
24 stars 6 forks source link

Fix missing compiler flags, implement stack smashing protector and kernel panic #8

Closed Bananymous closed 6 months ago

Bananymous commented 6 months ago

PC Speaker was removed in 716db407e4690c0a62555f2602ae193a1e66c0f9 so this PR adds it back.

Kernel is now compiled with -O2 instead of -O3. -O3 tends to unnecessarily increase the size of binary with optimizations that just might work. It is not uncommon that -O3 would make code run slower than -O2. Usually the change is only done after actual benchmarks of the performance gains and the comparison of the size of binary are considered.

Implement basic SSP that should cause kernel panic on stack overflows. This will help to notice bugs regarding stack early and easily.

Implement basic kernel panic that prints source of the panic, custom message and halts the CPU. This should be used as a last resort on unrecoverable or invalid states. For example if ISR handler is called with invalid number. In that case whole IVT is probably corrupted as ISR >= 32 should be mapped to IRQ handler or not mapped at all.