用来访问磁盘的哪种寻址模式? [英] Which addressing mode to be used to access disk?

查看:114
本文介绍了用来访问磁盘的哪种寻址模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习OS开发并且还处于初级阶段.我创建了一个简单的引导加载程序.要访问磁盘上的其他文件(例如HDD或USB驱动器),我应该使用哪种寻址模式?(CHS或LBA或INT 13h扩展名).

I am learning OS development and I'm in preliminary level. I created a simple boot loader. To access other files on the disk(say HDD or USB drive), which addressing mode should I use?(CHS or LBA or INT 13h extensions).

这些寻址模式中的哪一个非常有效(意味着,可以用于大多数驱动器)?

Which of these addressing mode is very efficient(means, can be used for most of the drive)?

谢谢

推荐答案

首先,INT13h扩展是对API的扩展,而不是HD寻址方法.

First of all, the INT13h extensions are an extension to an API, not an HD addressing method.

您必须确定要使用BIOS还是直接进行硬件访问.
使用BIOS是不切实际的,因为它提供16位接口.但是,它非常易于使用.在这种情况下,您将使用LBA作为寻址方法.

You have to settle on whether you are going to use the BIOS or direct hardware access.
Using the BIOS is impractical, as it offers a 16-bit interface. However, it's very easy to use. In this case, you will use LBA as the addressing method.

LBA对于CHS就像弧度一样. 它是一个更自然的单位,它打破了504MiB和7.9GiB的限制. 有使用理由很少CHS . CHS是历史悠久的人工制品,早于HDD在公共市场上的普及.

LBA is to CHS like radians are to degrees. It is a much more natural unit and it breaks the 504 MiB and the 7.9 GiB limits. There is little reason to use CHS. CHS is a historical artefact that predates the diffusion of HDDs on the public market.

如果要使用直接硬件访问,则只能使用LBA.在撰写本文时,当前 ATA/ATAPI 8命令集已弃用的CHS:

If you are going to use direct hardware access, then you can only use LBA. At the time of writing, the current ATA/ATAPI 8 Command Set deprecated CHS:

在标准ATA/ATAPI-5和更早版本中,定义了CHS转换.此翻译已过时,但如果 实施时,必须按照ATA/ATAPI-5中的规定实施.

In standards ATA/ATAPI-5 and earlier, a CHS translation was defined. This translation is obsolete but if implemented it shall be implemented as defined in ATA/ATAPI-5.

但是,通过直接硬件访问来访问磁盘并不是指日可待的事情,您至少需要一个基本的PCI/PCIe或USB总线驱动程序来访问磁盘控制器,一个主机控制器驱动程序(可以是 IDE

Accessing the disk with direct hardware access is, however, not quite around the corner, you need at least a basic PCI/PCIe or USB bus driver to access the disk controller, a host controller driver (which can be IDE, AHCI, NVMe for PCI/PCIe devices) to issue commands to the disks and and driver that implements the protocol used by those commands (e.g. SCSI and variants, ATA/ATAPI, MMC, UMS and so on).

因此,我相信您将使用INT13h扩展,在这种情况下,最好的寻址方法是BIOS提供的64位LBA.

So I believe you will use INT13h extensions, and in such scenario, the best addressing method is the 64-bit LBA offered by the BIOS.

这篇关于用来访问磁盘的哪种寻址模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆