hard disk in Bochs

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
User avatar
nicola
Member
Member
Posts: 32
Joined: Mon May 16, 2011 2:05 pm
Location: hanoi

hard disk in Bochs

Post by nicola »

is the hard disk type emulated by Bochs ATA (IDE) or SATA?

or they are just the same in the sense of accessing it from assembly?

and is it possible to access SATA using AHCI in Bochs?
I'm using AMD Sempron 140 Single core 2.7GHz
User avatar
nicola
Member
Member
Posts: 32
Joined: Mon May 16, 2011 2:05 pm
Location: hanoi

Re: hard disk in Bochs

Post by nicola »

i found in bochs config file for image:

ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, mode=flat, translation=auto, path=......

this means bochs emulating ATA (IDE). :D

but any example in assembly of accessing ATA (without using interrupts)?
I'm using AMD Sempron 140 Single core 2.7GHz
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: hard disk in Bochs

Post by thepowersgang »

Please, search the wiki before posting on the forums. All your questions are answered on the wiki

Look up the ATA PIO article.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
User avatar
nicola
Member
Member
Posts: 32
Joined: Mon May 16, 2011 2:05 pm
Location: hanoi

Re: hard disk in Bochs

Post by nicola »

i typed "ata pio" into the search box of osdev wiki but none found,
luckily searching that phrase by google gives me the link to that "ATA PIO Mode"
tks thepowersgang
I'm using AMD Sempron 140 Single core 2.7GHz
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: hard disk in Bochs

Post by Brendan »

Hi,
nicola wrote:is the hard disk type emulated by Bochs ATA (IDE) or SATA?

or they are just the same in the sense of accessing it from assembly?

and is it possible to access SATA using AHCI in Bochs?
The "features" section of the Bochs user manual says exactly what Bochs supports.

However, you wouldn't need to know unless you're ready to start writing a driver for the disk controller; and if you're ready to start writing a driver for the disk controller then you must've already done code to scan PCI buses and detect which PCI devices are present, which means your own software can tell you what sort of PCI device the disk controller is.

Note: If a computer (including Bochs if configured without the i440FX PCI chipset) doesn't support PCI at all, then you'd have to probe for old ISA devices during your "hardware auto-detection" phase. PCI was introduced a long time before SATA existed, so all SATA controllers use some sort of PCI bus, and you can assume that if there's no PCI there's no SATA.

Basically, if you need to ask what sort of disk controller is present, then you don't need to ask what sort of disk controller is present yet, and you've overlooked a fundamental piece of the OS (hardware auto-detection).
nicola wrote:or they are just the same in the sense of accessing it from assembly?
SATA controllers can have 2 different modes - "legacy mode" where they emulate PATA, and "AHCI" where they don't emulate PATA. If the SATA controller doesn't support legacy mode then you have to support AHCI, and if the SATA controller does support "legacy mode" then it'd be better to switch it to "AHCI".


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply