Page 1 of 1
Hard disk control
Posted: Tue Sep 29, 2020 9:28 am
by PavelChekov
How do I read and write to the hard disk with assembly or C, without using INT 13h? I am trying to keep up to date and Intel is dropping support for PC BIOS in favor for UEFI, I am new, but want to have a modern OS. Most of the stuff I see online these days only works on IBM PCs, and I want mine to run on a 2010 Dell Laptop running Linux.
Thx,
Checkov
Re: Hard disk control
Posted: Tue Sep 29, 2020 11:11 am
by Octacone
You need to write a PATA (IDE)/SATA (AHCI) driver.
Check out:
https://wiki.osdev.org/Storage
Re: Hard disk control
Posted: Tue Sep 29, 2020 11:20 am
by foliagecanine
In general, storage is not UEFI/BIOS specific, but usually mapped to the
PCI bus.
There might be a UEFI function to read the disk, but you're probably better off writing a IDE or AHCI driver.
I would assume that a 2010 laptop would be AHCI SATA, so take a look at the
AHCI page.
AHCI is a bit harder than IDE to program but has a lot more features.
It is also possible that your laptop could have IDE emulation in the BIOS/UEFI settings.
However, have you verified that your laptop is UEFI? AFAIK 2010 is pretty early for UEFI.
And what do you mean by "2010 Dell Laptop running
Linux"?
Is Linux the current operating system? You don't need any operating system to run an operating system unless you're emulating it.
Re: Hard disk control
Posted: Tue Sep 29, 2020 11:21 am
by PavelChekov
I simply meant that whatever it is should compile or such on NASM and GCC
Re: Hard disk control
Posted: Tue Sep 29, 2020 11:34 am
by foliagecanine
Ah okay. So you were saying the build machine runs Linux.
Good luck!
Re: Hard disk control
Posted: Tue Sep 29, 2020 11:53 am
by PavelChekov
The thing is, I have also created my own file system.
Re: Hard disk control
Posted: Tue Sep 29, 2020 12:02 pm
by foliagecanine
The filesystem driver goes on top of the hard disk driver.
Basically, you first want to be able to read and write sectors to the disk before you worry about files.
Re: Hard disk control
Posted: Tue Sep 29, 2020 12:19 pm
by PeterX
PavelCheckov wrote:How do I read and write to the hard disk with assembly or C, without using INT 13h? I am trying to keep up to date and Intel is dropping support for PC BIOS in favor for UEFI, I am new, but want to have a modern OS. Most of the stuff I see online these days only works on IBM PCs, and I want mine to run on a 2010 Dell Laptop running Linux.
First you must find out what protocol is used for your laptop's harddisk. ATA/IDE? Serial ATA (SATA)? SCSI?
Octacone gave you a useful link for disk programming.
Greetings
Peter