Help,Does any know how to call bios int13 routine on ubuntu?

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
atmgnd
Posts: 5
Joined: Thu Feb 27, 2020 12:51 am

Help,Does any know how to call bios int13 routine on ubuntu?

Post by atmgnd »

Hello, I want to know How to read/write disks(the first main disk) using bios on ubuntu protected mode.

First, (use a vm, ), I have disabled the orig ahci/ide linux drivers by rename /lib/modules/`uname -r`/kernel/drivers/ata to /lib/modules/`uname -r`/kernel/drivers/ata_backup. Is this necessary ?

I'm not familier familiar with real mode programming. here is what i got so far:
1. Use "Protected Mode BIOS Call Functionailty" by Napalm, it seems have to write asm.
2. Use LRMI from http://www.codon.org.uk/~mjg59/libx86/, but i I can't found any examples about how to read/write disks.

and my operation system is lubuntu 18.04 32bit, any 32bit system is ok, i think.

Thanks, all
Attachments
lrmi.tar.gz
downloaded from ubuntu src repo
(10.13 KiB) Downloaded 28 times
Octocontrabass
Member
Member
Posts: 5578
Joined: Mon Mar 25, 2013 7:01 pm

Re: Help,Does any know how to call bios int13 routine on ubu

Post by Octocontrabass »

atmgnd wrote:Hello, I want to know How to read/write disks(the first main disk) using bios on ubuntu protected mode.
Why?
atmgnd
Posts: 5
Joined: Thu Feb 27, 2020 12:51 am

Re: Help,Does any know how to call bios int13 routine on ubu

Post by atmgnd »

Octocontrabass wrote:
atmgnd wrote:Hello, I want to know How to read/write disks(the first main disk) using bios on ubuntu protected mode.
Why?
The reason is I got some sata controller not work well using modern sata/ahci mode.
can any one give some examples or resource to do that ? Help wanted. thanks alot.
also, I wonder why there is tools like vbetool(running under real mode), but no tools like rmdisk, realhd ?
Octocontrabass
Member
Member
Posts: 5578
Joined: Mon Mar 25, 2013 7:01 pm

Re: Help,Does any know how to call bios int13 routine on ubu

Post by Octocontrabass »

atmgnd wrote:The reason is I got some sata controller not work well using modern sata/ahci mode.
In that case, you should look at improving the AHCI driver in Linux. (It might even be fixed already, in a newer kernel.)

If the SATA controller has a legacy IDE mode, try that and see if it works any better.
atmgnd wrote:also, I wonder why there is tools like vbetool(running under real mode), but no tools like rmdisk, realhd ?
Changing the display mode is something that you usually do only once, when the computer boots up. Accessing the hard disk happens all the time. It doesn't matter if you have to pause everything to use the limited, slow BIOS once during boot. But would you like it very much if your computer had to stop everything in order to access the hard disk?
atmgnd
Posts: 5
Joined: Thu Feb 27, 2020 12:51 am

Re: Help,Does any know how to call bios int13 routine on ubu

Post by atmgnd »

Octocontrabass wrote:
atmgnd wrote:The reason is I got some sata controller not work well using modern sata/ahci mode.
In that case, you should look at improving the AHCI driver in Linux. (It might even be fixed already, in a newer kernel.)

If the SATA controller has a legacy IDE mode, try that and see if it works any better.
atmgnd wrote:also, I wonder why there is tools like vbetool(running under real mode), but no tools like rmdisk, realhd ?
Changing the display mode is something that you usually do only once, when the computer boots up. Accessing the hard disk happens all the time. It doesn't matter if you have to pause everything to use the limited, slow BIOS once during boot. But would you like it very much if your computer had to stop everything in order to access the hard disk?
I have spent alot of time on ahci/sata way, and it's confirmed by the manufacturer there is no future fix plan(some issue to sata controller firmware).
What i plan to is I disable all linux disk drivers, and I will write a simple block/disk driver using bios to read/write disks.
I believe I can handle the linux disk driver part, because there is many examples on internet.
But what I dont know is how to access bios disk routine(lrmi, or asm?).
thanks alot, does any
atmgnd
Posts: 5
Joined: Thu Feb 27, 2020 12:51 am

Re: Help,Does any know how to call bios int13 routine on ubu

Post by atmgnd »

And I know the bios is very slow, but I think I am ok with that.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Help,Does any know how to call bios int13 routine on ubu

Post by iansjack »

Even if you could access the BIOS in this way (which I very much doubt), I'll bet a dollar to a cent that the result will be an order of magnitude slower than the Linux driver (however poor it might be).
atmgnd
Posts: 5
Joined: Thu Feb 27, 2020 12:51 am

Re: Help,Does any know how to call bios int13 routine on ubu

Post by atmgnd »

Does any one have some examples ( or just some pieces), I currently use a virtual machine to develop/test the prototype, and I no luck so far.
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Help,Does any know how to call bios int13 routine on ubu

Post by PeterX »

Of course older programmers (like me) and retro fans can have fond feelings of the BIOS. There is something nostalgic about using an int 13h disk read.

But on Linux and other protected mode (or long mode) operating systems you make a deep sigh and get rid of that 1980s-style, 16bit, complicated, weird Legacy BIOS. You use it for bootloading (including hardware diagnostics ansd setup) and that was it. Afaik even the die-hard BIOS fans don't _want_ to use BIOS in Linux. Well, except in DOSBOX/DOSEMU and Bochs/Qemu and such emulators but not in Linux directly.

And I think sooner or later there will be no Legacy BIOS in the hardware. Because there is EFI/UEFI. Like 386 once was state-of-the-art and is now gone, so will Legacy BIOS be gone some day. Just's at least, what I expect to happen.

The Legacy BIOS and Linux are very different worlds! It is technically possible to reserve all BIOS-relevant memory and constantly jump back between real and protected mode (like DPMI does, for example). But I really don't recommend that. EDIT: And there will probably severe interrupt problems...!

Happy hacking
Peter
Post Reply