NASM:如何正确访问SSD驱动器? [英] NASM: how to access ssd drive correctly?

查看:123
本文介绍了NASM:如何正确访问SSD驱动器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用NASM 16位代码访问SSD驱动器.访问常规硬盘驱动器时,需要设置寄存器AX,DX,CX以选择圆柱体/磁道/扇区/扇区数( AH -选择读取扇区功能, DL -选择驱动器号, CH -选择柱面, DH -选择磁盘侧面, CL -选择磁道, AL -选择扇区数).

I need to access SSD drive with NASM 16-bit code. When accessing regular hard drive, need to set registers AX, DX, CX to choose Cylinder/Track/Sector/Number of sectors (AH - to choose read sector function, DL - to choose drive number, CH - to choose cylinder, DH - to choose side on disk, CL - to choose sector on track, AL - to choose number of sectors).

但是,我认为SSD磁盘具有其他结构,那么如何正确访问它们呢?

However, I suppose SSD disk has some other structure, so how to access them correctly?

推荐答案

假定将伪几何图形转换为LBA(最可能的情况),"int 0x13,ah = 0x02"最多只能处理16515072个扇区.每个扇区512字节(也是最可能的情况)达到8064 MiB或7.8 GiB.硬盘驱动器(包括SSD)的容量已经超过了大约20年.因此"int 0x13,ah = 0x02"不是明智的选择.

Assuming translation of fake geometry into LBA (the most likely case), "int 0x13, ah=0x02" can only handle a maximum of 16515072 sectors. At 512 bytes per sector (also the most likely case) that works out to 8064 MiB or about 7.8 GiB. Hard drives (including SSDs) have been larger than this for about 2 decades; so "int 0x13, ah=0x02" isn't a sane option.

相反,对于硬盘驱动器(包括SSD),您要使用"int 0x13,ah = 0x42"(请参见 http://www.ctyme.com/intr/rb-0708.htm ).该函数使用LBA地址,而不使用CHS;并且具有64位LBA地址和每个扇区相同的512字节),它可以处理(最多)8589934592 TiB驱动器.

Instead, for hard drives (including SSD) you want to use "int 0x13, ah=0x42" (see http://www.ctyme.com/intr/rb-0708.htm ). This function uses LBA addresses and doesn't use CHS; and (with 64-bit LBA address and the same 512 bytes per sector) it can handle (up to) 8589934592 TiB drives.

这篇关于NASM:如何正确访问SSD驱动器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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