BIOS int 13 扩展

本文深入解析了 BIOS 中断 INT 13 的扩展功能,包括检查 LBA 支持、读写磁盘等高级操作,并提供了详细的指令代码示例。通过本文,读者可以了解到 INT 13 在不同版本中的变化及其实现细节。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

*********grub4dos0.44 source code**************

 

/* check if LBA is supported */

movb $0x41, %ah

movw $0x55aa, %bx

int $0x13

 

/* 

*  %dl may have been clobbered by INT 13, AH=41H.

*  This happens, for example, with AST BIOS 1.04.

*/

popw %dx

pushw %dx

 

/* use CHS if fails */

jc chs_mode

cmpw $0xaa55, %bx

jne chs_mode


 

 

 

*****   extend   Hard   Disk   function   *****

    
  --------d-1341--BX55AA-----------------------   
  INT   13   -   IBM/MS   INT   13   Extensions   -   INSTALLATION   CHECK   
  AH   =   41h   
  BX   =   55AAh   
  DL   =   drive   (80h-FFh)   
  Return:   CF   set   on   error   (extensions   not   supported)   
  AH   =   01h   (invalid   function)   
  CF   clear   if   successful   
  BX   =   AA55h   if   installed   
  AH   =   major   version   of   extensions   
  01h   =   1.x   
  20h   =   2.0   /   EDD-1.0   
  21h   =   2.1   /   EDD-1.1   
  30h   =   EDD-3.0   
  AL   =   internal   use   
  CX   =   API   subset   support   bitmap   (see   #00271)   
  DH   =   extension   version   (v2.0+   ???   --   not   present   in   1.x)   
  Note:   the   Phoenix   Enhanced   Disk   Drive   Specification   v1.0   uses   version   2.0   of   
  the   INT   13   Extensions   API   
  SeeAlso:   AH=42h"INT   13   Ext",AH=48h"INT   13   Ext"   
    
  Bitfields   for   IBM/MS   INT   13   Extensions   API   support   bitmap:   
  Bit(s)   Description   (Table   00271)   
  0   extended   disk   access   functions   (AH=42h-44h,47h,48h)   supported   
  1   removable   drive   controller   functions   (AH=45h,46h,48h,49h,INT   15/AH=52h)   
  supported   
  2   enhanced   disk   drive   (EDD)   functions   (AH=48h,AH=4Eh)   supported   
  extended   drive   parameter   table   is   valid   (see   #00273,#00278)   
  3-15   reserved   (0)   
  --------c-1341-------------------------------   
  INT   13   U   -   QUICKCACHE   II   v4.20   -   SAVE/RESTORE   ???   
  AH   =   41h   
  AL   =   direction   
  01h   save   to   file   
  else   restore   from   file   
  ES:DI   ->   1024-byte   buffer   for   ???   
  Return:   AX   =   status   (0000h   successful,   8000h   failed)   
  Program:   QUICKCACHE   II   is   a   shareware   disk   cache   by   P.R.   Glassel   and   
  Associates,   Inc.   
  SeeAlso:   AH=40h"QUICKCACHE"   
  --------d-1342-------------------------------   
  INT   13   -   IBM/MS   INT   13   Extensions   -   EXTENDED   READ   
  AH   =   42h   
  DL   =   drive   number   
  DS:SI   ->   disk   address   packet   (see   #00272)   
  Return:   CF   clear   if   successful   
  AH   =   00h   
  CF   set   on   error   
  AH   =   error   code   (see   #00234)   
  disk   address   packet's   block   count   field   set   to   number   of   blocks   
  successfully   transferred   
  SeeAlso:   AH=02h,AH=41h"INT   13   Ext",AH=43h"INT   13   Ext"   
    
  Format   of   disk   address   packet:   
  Offset   Size   Description   (Table   00272)   
  00h   BYTE   10h   (size   of   packet)   
  01h   BYTE   reserved   (0)   
  02h   WORD   number   of   blocks   to   transfer   (max   007Fh   for   Phoenix   EDD)   
  04h   DWORD   ->   transfer   buffer   
  08h   QWORD   starting   absolute   block   number   
  (for   non-LBA   devices,   compute   as   
  (Cylinder*NumHeads   +   SelectedHead)   *   SectorPerTrack   +   
  SelectedSector   -   1   
  --------N-134257DX1234-----------------------   
  INT   13   U   -   Beame&Whiteside   BWLPD   -   INSTALLATION   CHECK   
  AX   =   4257h   ("BW")   
  DX   =   1234h   
  Return:   BX   =   414Ch   if   installed   
  Program:   BWLPD   is   the   printer   daemon   from   the   BW-NFS   package   
  SeeAlso:   INT   62/AH=00h"ETHDEV"   
  --------d-1343-------------------------------   
  INT   13   -   IBM/MS   INT   13   Extensions   -   EXTENDED   WRITE   
  AH   =   43h   
  AL   =   write   flags   
  ---v1.0,2.0---   
  bit   0:   verify   write   
  bits   7-1   reserved   (0)   
  ---v2.1+   ---   
  00h,01h   write   without   verify   
  02h   write   with   verify   
  DL   =   drive   number   
  DS:SI   ->   disk   address   packet   (see   #00272)   
  Return:   CF   clear   if   successful   
  AH   =   00h   
  CF   set   on   error   
  AH   =   error   code   (see   #00234)   
  disk   address   packet's   block   count   field   set   to   number   of   blocks   
  successfully   transferred   
  Note:   the   BIOS   returns   CF   set/AH=01h   (invalid   function)   if   verify   is   
  requested   but   not   supported   
  SeeAlso:   AH=03h,AH=41h"INT   13   Ext",AH=42h"INT   13   Ext",AH=44h   
  --------d-1344-------------------------------   
  INT   13   -   IBM/MS   INT   13   Extensions   -   VERIFY   SECTORS   
  AH   =   44h   
  DL   =   drive   number   
  DS:SI   ->   disk   address   packet   (see   #00272)   
  Return:   CF   clear   if   successful   
  AH   =   00h   
  CF   set   on   error   
  AH   =   error   code   (see   #00234)   
  disk   address   packet's   block   count   field   set   to   number   of   blocks   
  successfully   verified   
  SeeAlso:   AH=04h,AH=41h"INT   13   Ext",AH=42h"INT   13   Ext",AH=47h   
  --------d-1345-------------------------------   
  INT   13   -   IBM/MS   INT   13   Extensions   -   LOCK/UNLOCK   DRIVE   
  AH   =   45h   
  AL   =   operation   
  00h   lock   media   in   drive   
  01h   unlock   media   
  02h   check   lock   status   
  DL   =   drive   number   
  Return:   CF   clear   if   successful   
  AH   =   00h   
  AL   =   lock   state   (00h   =   unlocked)   
  CF   set   on   error   
  AH   =   error   code   (see   #00234)   
  Notes:   this   function   is   required   to   be   supported   for   any   removable   drives   
  numbered   80h   or   higher   
  up   to   255   locks   may   be   placed   on   a   drive,   and   the   media   will   not   
  be   physically   unlocked   until   all   locks   have   been   removed   
  SeeAlso:   AH=41h"INT   13   Ext",AH=46h,AH=49h,INT   15/AH=52h"INT   13   Extensions"   
  --------d-1346-------------------------------   
  INT   13   -   IBM/MS   INT   13   Extensions   -   EJECT   MEDIA   
  AH   =   46h   
  AL   =   00h   (reserved)   
  DL   =   drive   number   
  Return:   CF   clear   if   successful   
  AH   =   00h   
  CF   set   on   error   
  AH   =   error   code   (see   #00234)   
  SeeAlso:   AH=49h,INT   15/AH=52h"INT   13   Extensions"   
  --------d-1347-------------------------------   
  INT   13   -   IBM/MS   INT   13   Extensions   -   EXTENDED   SEEK   
  AH   =   47h   
  DL   =   drive   number   
  DS:SI   ->   disk   address   packet   (see   #00272)   
  Return:   CF   clear   if   successful   
  AH   =   00h   
  CF   set   on   error   
  AH   =   error   code   (see   #00234)   
  SeeAlso:   AH=0Ch,AH=42h"INT   13   Ext"   

 

最近网上看到一篇关于测试bios中断文章,

http://www.cnblogs.com/ljf9201314/archive/2008/07/21/1247653.html

 

再附上bios中断表

http://www.oldlinux.org/Linux.old/docs/interrupts/int-html/int-13.htm

 

维基百科关于int 13 扩展的描述,

http://en.wikipedia.org/wiki/INT_13#Drive_Table

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值