浅析 Legacy INT 13h中断函数

浅析 Legacy INT 13h中断函数

在BIOS进入UEFI时代之后,似乎Legacy BIOS的东西正在走向死亡。但传统的legacy产物退出历史舞台还需要一个过程, legacy中断就是其中之一。本文要讲的INT 13h中断函数就是legacy中断中的一种。它主要是为磁盘操作服务。

1 文档 (Enhanced Disk Drive Spec 4.0)

2 定义和缩写

  • CHS: A method of addressing the contents of a storage device using logical cylinder (C), logical heads(H) and logical sectors(S).
  • LBA: Logical Block Address
  • BDA: BIOS Data Area
  • ATA: AT Atachment Device, known as IDE

3 INT 13H 函数定义

FunctionDefinition
FN 00hReset Disk Subsystem
FN 01hGet Status of Last Operation
FN 02hRead Sectors into Memory
FN 03hWrite Sectors from Memory
FN 04hVerify Sectors
FN 08hGet Drive Parameters
FN 0EhRead Buffer
FN 0FhWrite Buffer
FN 15hGet Disk Type
FN 18hSet Media Type
FN 19hPark Heads
FN 25hIdentify Device Information
FN 41hCheck Extension Present
FN 42hExtended Read
FN 43hExtended Write
FN 44hVerify Sectors
FN 45hLock/Unlock Media
FN 46hEject Removable Media
FN 48hGet Device Parameters
FN 49hGet Extended Media Change Status
FN 4ahInitiate Disk Enumation
FN 4bhTerminate Disk Enumation
FN 4chInitiate Disk Enumation & Boot
FN 4dhReturn Boot Catalog
FN 4ehSet Hardware Configuration
FN 50hSend Packet Command
FN 51hSecurity Protocol Command

4 如何通过 INT 13h 判断EDD的版本

注意到 FN 41h可以check Extension Present

Entry:
    AH 41h
    BX 55AAh
    DL BIOS device number
Exit:
    Carry clear, function complete without error
    AH Versions of Extension (30h - version 3.0, 21h - version 1.1)
    AL Verdor specific
    BX AA55h
    CX Interface support bit map (See below table)
    Carry set, function complete with error
    AH 01h (invalid command)
BitDescription
0Fixed disk access subset shall be supported.
1Device locking and injecting subset shall be supported
2Enhanced Disk Drive subset shall be supported
364-bit Extensions are present
4:15reserved
When the 64-bit extensions are present, the fields starting at offset 10h in the Device Address Packet are valid. 
所以只要调用FN 41h函数,然后check carry bit,确定carry bit没有被置起来,check AH的返回值。30h对应version 3.0. 21h对应version 1.1.

5. INT 13H Address Format 

使用INT 13H需要以下数据格式



  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值