pritamzope / OS

Writing & Making Operating System and Kernel parts so simple like Hello World Programs, Starting from writing Bootloaders, Hello World Kernel, GDT, IDT, Terminal, Keyboard/Mouse, Memory Manager, HDD ATA R/W, VGA/VESA Graphics
http://createyourownos.blogspot.com
663 stars 103 forks source link

Fix BIOS32 so it can be more reliable #31

Open sasdallas opened 1 month ago

sasdallas commented 1 month ago

Hi,

I've noticed a few bugs in your BIOS32 implementation that I myself had, and later fixed.

For instance - you called sti to enable interrupts, but that will also enable external interrupts which have not been mapped in the IDT/GDT (since they are real mode) and will crash the system if BIOS32 is used in a more high-level environment.

A few other fixes, such as not clobbering a few other registers and flushing the TLB after disabling paging, and here is my result.

Your previous code, while it works, will cause issues if used in a higher-level system, like my OS. I learned and solved these bugs the hard way. Specifically, BIOS32 causes serious issues when combined with virtual memory management.

I have tested the code changes and they pass the tests, and produce the same results as your old code but can be used in higher-level implementations.

I hope this helps! Please let me know if further changes are needed.