Usage of BIOS

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
sagiv
Posts: 3
Joined: Fri Mar 25, 2022 10:11 am
Libera.chat IRC: sagiv

Usage of BIOS

Post by sagiv »

Hello there.
I'm fairly new to OS development, I try to absorb as much knowledge as I can from practical tutorials, NPTEL courses and the wiki.
I have stumbled upon https://wiki.osdev.org/Real_Mode_OS_Warning which is the warning of relying on the BIOS too much.
My question is, how else can I set up the environment in the first steps? because all the tutorials I have seen used BIOS interrupts to check for the A20 gate and get the memory map.
Thank you.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Usage of BIOS

Post by Octocontrabass »

sagiv wrote:tutorials
Be careful. OS development tutorials tend to have bugs in them.
sagiv wrote:My question is, how else can I set up the environment in the first steps?
Let the bootloader worry about that. You can write an OS without writing a bootloader.

If you end up writing your own bootloader, then your bootloader will use the BIOS (or UEFI boot services) to set up the initial environment, and the rest of your OS will not use the BIOS (or UEFI boot services).
nullplan
Member
Member
Posts: 1790
Joined: Wed Aug 30, 2017 8:24 am

Re: Usage of BIOS

Post by nullplan »

sagiv wrote:My question is, how else can I set up the environment in the first steps? because all the tutorials I have seen used BIOS interrupts to check for the A20 gate and get the memory map.
That won't help you with any current PC, because those typically lack a BIOS (in favor of UEFI), and might not even support A20 mask functionality, because it has been a while since anyone used Turbo Pascal 3 on real hardware.

As Octo said, I would focus on writing a kernel and let it be loaded by a bootloader. If you want the challenge of writing a bootloader, you can do so later, and you can make your bootloader implement the same boot protocol used by your kernel. I actually use a double-wrapped approach, wherein the boot protocol for the actual kernel is bespoke, but I have a UEFI loader and a Multiboot 32-bit loader, and they just copy the information they receive from their respective environments into a unified structure for my kernel to use.

However, the days of the legacy BIOS are over, and no new project should be using it in this day and age.
Carpe diem!
sagiv
Posts: 3
Joined: Fri Mar 25, 2022 10:11 am
Libera.chat IRC: sagiv

Re: Usage of BIOS

Post by sagiv »

Octocontrabass wrote:
sagiv wrote:tutorials
Be careful. OS development tutorials tend to have bugs in them.
sagiv wrote:My question is, how else can I set up the environment in the first steps?
Let the bootloader worry about that. You can write an OS without writing a bootloader.

If you end up writing your own bootloader, then your bootloader will use the BIOS (or UEFI boot services) to set up the initial environment, and the rest of your OS will not use the BIOS (or UEFI boot services).
I will want to try my hand at a bootloader, eventually, but I guess for the time being I focus on the OS itself.
Thanks.
nullplan wrote:
sagiv wrote:My question is, how else can I set up the environment in the first steps? because all the tutorials I have seen used BIOS interrupts to check for the A20 gate and get the memory map.
That won't help you with any current PC, because those typically lack a BIOS (in favor of UEFI), and might not even support A20 mask functionality, because it has been a while since anyone used Turbo Pascal 3 on real hardware.

As Octo said, I would focus on writing a kernel and let it be loaded by a bootloader. If you want the challenge of writing a bootloader, you can do so later, and you can make your bootloader implement the same boot protocol used by your kernel. I actually use a double-wrapped approach, wherein the boot protocol for the actual kernel is bespoke, but I have a UEFI loader and a Multiboot 32-bit loader, and they just copy the information they receive from their respective environments into a unified structure for my kernel to use.

However, the days of the legacy BIOS are over, and no new project should be using it in this day and age.
Thank you, I will take it into consideration in my studies and research.
Post Reply