Can not use ATA PIO mode in Qemu

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
shore
Posts: 15
Joined: Wed Sep 04, 2019 9:00 pm

Can not use ATA PIO mode in Qemu

Post by shore »

Hi I'm following a book to write a kernel but meet problem with disk driver part of program.

My system is:
Manjaro: 18.1.5
Linux kernel: 5.5.2-1
Qemu: 4.2.0-1
I start Qemu by:

Code: Select all

qemu-system-x86_64 -machine q35 -cpu Broadwell -accel kvm -m 1G Boot.disk
I use ATA PIO mode to access disk. However, when trying to read port 0x1F1 to detect errors, it returns 255. While in Bochs or VirtualBox, it is 0. Also interrupts are not able to react.

But, keyboard and mouse are driver works fine. And when in int 13h also works.

So I'm kind of don't know what to do, and seeking for help in here.

Hope someone can help me on this. Thanks!
Octocontrabass
Member
Member
Posts: 5578
Joined: Mon Mar 25, 2013 7:01 pm

Re: Can not use ATA PIO mode in Qemu

Post by Octocontrabass »

shore wrote:-machine q35
The q35 machine does not include an IDE controller. Use the default "pc" machine, or write an AHCI driver.
iProgramInCpp
Member
Member
Posts: 81
Joined: Sun Apr 21, 2019 7:39 am

Re: Can not use ATA PIO mode in Qemu

Post by iProgramInCpp »

I use this argument:

Code: Select all

 -drive file=%path%\build\harddrive.raw,index=0,if=ide,format=raw
Hey! I'm developing two operating systems:

NanoShell --- A 32-bit operating system whose GUI takes inspiration from Windows 9x and early UNIX desktop managers.
Boron --- A portable SMP operating system taking inspiration from the design of the Windows NT kernel.
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: Can not use ATA PIO mode in Qemu

Post by Klakap »

Or try easiest

Code: Select all

-hda harddisc.img
Post Reply